DEPRECATED: Use the community maintained https://tangled.sh/@tangled.sh/knot-docker instead
1FROM alpine AS build
2RUN apk add --update go git gcc musl-dev
3RUN git clone https://tangled.sh/@tangled.sh/core /src
4WORKDIR /src
5ENV CGO_ENABLED=1
6RUN cd cmd/knotserver && go build
7RUN cd cmd/keyfetch && go build
8RUN cd cmd/repoguard && go build
9FROM alpine
10RUN apk add --update git openssh-server su-exec
11RUN addgroup -g 1000 git && \
12 adduser -D -u 1000 -G git -h /home/git git && \
13 mkdir -p /home/git && \
14 chown -R git:git /home/git
15COPY --from=build /src/cmd/knotserver/knotserver /usr/bin/knotserver
16COPY --from=build /src/cmd/keyfetch/keyfetch /usr/bin/keyfetch
17COPY --from=build /src/cmd/repoguard/repoguard /usr/bin/repoguard
18COPY keyfetch_sshd_config /tmp/keyfetch
19RUN cat /tmp/keyfetch >> /etc/ssh/sshd_config && rm /tmp/keyfetch
20COPY ssh_host_ed25519_key /etc/ssh
21COPY ssh_host_ed25519_key.pub /etc/ssh
22RUN chmod 600 /etc/ssh/ssh_host_ed25519_key
23RUN chmod 644 /etc/ssh/ssh_host_ed25519_key.pub
24COPY gitconfig /home/git/.gitconfig
25RUN passwd -u git
26CMD ["/bin/sh", "-c", "chown -R git:git /home/git && /usr/sbin/sshd && su-exec git knotserver"]