forked from codefresh-io/cf-git-cloner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
28 lines (21 loc) · 852 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM alpine:3.15.6
RUN apk add --no-cache git=~2.34.4 bash openssh
# install git-lfs
RUN apk add --no-cache --virtual deps openssl && \
export ARCH=$([[ "$(uname -m)" == "aarch64" ]] && echo "arm64" || echo "amd64") && \
wget -qO- https://github.com/git-lfs/git-lfs/releases/download/v2.12.1/git-lfs-linux-${ARCH}-v2.12.1.tar.gz | tar xz && \
mv git-lfs /usr/bin/ && \
git lfs install && \
apk del deps
# add ssh record on which ssh key to use
COPY ./.ssh/ /root/.ssh/
# add fingerprint for major git providers
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts
RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts
COPY ./start.sh /run/start.sh
RUN chmod +x /run/start.sh
#add non-root user
RUN addgroup -g 1000 nodegroup \
&& adduser -u 1000 -G nodegroup -s /bin/sh -D nodeuser
USER nodeuser
CMD ["/run/start.sh"]