Docker config for @recaptime.dev's Knot server on Hack Club Nest. knot.hackclub.community
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: fix syntax warning with Dockerfile LSP on Zed

Also use build args on base images so we can utilize GitLab Dependency
Proxy on CI builds.

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.dev>

+35 -33
+35 -33
Dockerfile
··· 1 - from golang:1.24-alpine as builder 2 - env KNOT_REPO_SCAN_PATH=/home/git/repositories 3 - env CGO_ENABLED=1 1 + ARG BUILDER_IMAGE=golang:1.24-alpine 2 + ARG DEPLOY_IMAGE=alpine:edge 3 + FROM ${BUILDER_IMAGE} as builder 4 + ENV KNOT_REPO_SCAN_PATH=/home/git/repositories 5 + ENV CGO_ENABLED=1 GOSUMDB=off GOPROXY=direct 4 6 5 - arg TAG='v1.11.0-alpha' 7 + ARG TAG='v1.11.0-alpha' 6 8 7 - workdir /app 8 - run apk add git gcc musl-dev 9 - run git clone -b ${TAG} https://tangled.org/@tangled.org/core . 10 - run go build -o /usr/bin/knot -ldflags '-s -w -extldflags "-static"' ./cmd/knot 9 + WORKDIR /app 10 + RUN apk add git gcc musl-dev 11 + RUN git clone -b ${TAG} https://tangled.org/@tangled.org/core . \ 12 + && go build -o /usr/bin/knot -ldflags '-s -w -extldflags "-static"' ./cmd/knot 11 13 12 - from alpine:edge 13 - expose 5555 14 - expose 22 14 + FROM ${DEPLOY_IMAGE} 15 + EXPOSE 5555 16 + EXPOSE 22 15 17 16 - label org.opencontainers.image.title='knot' 17 - label org.opencontainers.image.description='data server for tangled' 18 - label org.opencontainers.image.source='https://tangled.org/@tangled.org/knot-docker' 19 - label org.opencontainers.image.url='https://tangled.org' 20 - label org.opencontainers.image.vendor='tangled.org' 21 - label org.opencontainers.image.licenses='MIT' 18 + LABEL org.opencontainers.image.title='knot' \ 19 + org.opencontainers.image.description='data server for tangled' \ 20 + org.opencontainers.image.source='https://tangled.org/@tangled.org/knot-docker' \ 21 + org.opencontainers.image.url='https://tangled.org' \ 22 + org.opencontainers.image.vendor='tangled.org' \ 23 + org.opencontainers.image.licenses='MIT' 22 24 23 - arg UID=1000 24 - arg GID=1000 25 + ARG UID=1000 26 + ARG GID=1000 25 27 26 - copy rootfs . 27 - run chmod 755 /etc 28 - run chmod -R 755 /etc/s6-overlay 29 - run apk add shadow s6-overlay execline openssl openssh git curl bash 30 - run groupadd -g $GID -f git 31 - run useradd -u $UID -g $GID -d /home/git git 32 - run openssl rand -hex 16 | passwd --stdin git 33 - run mkdir -p /home/git/repositories && chown -R git:git /home/git 34 - copy --from=builder /usr/bin/knot /usr/bin 35 - copy motd.txt /home/git/motd 36 - run mkdir /app && chown -R git:git /app 28 + COPY rootfs . 29 + RUN chmod 755 /etc && chmod -R 755 /etc/s6-overlay \ 30 + && apk add shadow s6-overlay execline openssl openssh git curl bash \ 31 + && groupadd -g $GID -f git \ 32 + && useradd -u $UID -g $GID -d /home/git git \ 33 + && openssl rand -hex 16 | passwd --stdin git \ 34 + && mkdir -p /home/git/repositories && chown -R git:git /home/git \ 35 + && mkdir /app && chown -R git:git /app 37 36 38 - healthcheck --interval=60s --timeout=30s --start-period=5s --retries=3 \ 39 - cmd curl -f http://localhost:5555 || exit 1 37 + COPY --from=builder /usr/bin/knot /usr/bin 38 + COPY motd.txt /home/git/motd 40 39 41 - entrypoint ["/init"] 40 + HEALTHCHECK --interval=60s --timeout=30s --start-period=5s --retries=3 \ 41 + CMD curl -f http://localhost:5555 || exit 1 42 + 43 + ENTRYPOINT ["/init"]