Skip to content

Commit 6aa5bca

Browse files
committed
✨ Add Dockerfile and entrypoint
1 parent 7ac6fd5 commit 6aa5bca

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM alpine:3.10
2+
3+
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
4+
5+
RUN set -ex ;\
6+
sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories ;\
7+
apk add --update bash git inotify-tools openssh ;\
8+
git clone https://github.com/gitwatch/gitwatch.git ;\
9+
install -b gitwatch/gitwatch.sh /usr/local/bin/gitwatch ;\
10+
mkdir ~/.ssh ;\
11+
echo 'Host *' > ~/.ssh/config ;\
12+
echo ' StrictHostKeyChecking no' >> ~/.ssh/config ;\
13+
chmod 700 ~/.ssh ;\
14+
chmod +x /usr/local/bin/docker-entrypoint.sh ;\
15+
rm -rf /var/cache/apk/* ;\
16+
rm -rf gitwatch
17+
18+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

docker-entrypoint.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
if [ -n "${SSH_PRIVATE_KEY}" ]
4+
then
5+
echo "${SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa
6+
chmod 400 ~/.ssh/id_rsa
7+
fi
8+
9+
if [ -n "${EMAIL}" ]
10+
then
11+
git config --global user.email "${EMAIL}"
12+
fi
13+
if [ -n "${NAME}" ]
14+
then
15+
git config --global user.name "${NAME}"
16+
fi
17+
18+
if [ "${1:0:1}" = '-' ]
19+
then
20+
set -- gitwatch "$@"
21+
fi
22+
23+
exec "$@"
24+
# EOF

0 commit comments

Comments
 (0)