Personal docker image setups for Knot/Spindle
1FROM golang:1.25-alpine AS builder
2ENV KNOT_REPO_SCAN_PATH=/home/git/repositories
3ENV CGO_ENABLED=1
4
5ARG TAG='v1.11.0-alpha'
6
7WORKDIR /app
8RUN apk add git gcc musl-dev
9RUN git clone -b ${TAG} https://tangled.org/tangled.org/core .
10
11FROM builder AS build-knot
12RUN go build -o /usr/bin/knot -ldflags '-s -w -extldflags "-static"' ./cmd/knot
13
14FROM builder AS build-spindle
15RUN go build -o /usr/bin/spindle -ldflags '-s -w -extldflags "-static"' ./cmd/spindle
16
17FROM alpine:edge AS knot
18EXPOSE 5555
19EXPOSE 22
20
21LABEL org.opencontainers.image.title='knot'
22LABEL org.opencontainers.image.description='data server for tangled'
23LABEL org.opencontainers.image.source='https://tangled.org/sachy.dev/knot-spindle-docker'
24LABEL org.opencontainers.image.url='https://tangled.org'
25LABEL org.opencontainers.image.vendor='tangled.org'
26LABEL org.opencontainers.image.licenses='MIT'
27
28ARG UID=1000
29ARG GID=1000
30
31COPY rootfs .
32RUN chmod 755 /etc
33RUN chmod -R 755 /etc/s6-overlay
34RUN apk add shadow s6-overlay execline openssl openssh git curl bash
35RUN groupadd -g $GID -f git
36RUN useradd -u $UID -g $GID -d /home/git git
37RUN openssl rand -hex 16 | passwd --stdin git
38RUN mkdir -p /home/git/repositories && chown -R git:git /home/git
39COPY --from=build-knot /usr/bin/knot /usr/bin
40RUN mkdir /app && chown -R git:git /app
41
42HEALTHCHECK --interval=60s --timeout=30s --start-period=5s --retries=3 \
43 CMD curl -f http://localhost:5555 || exit 1
44
45ENTRYPOINT ["/init"]
46
47FROM alpine:edge AS spindle
48
49EXPOSE 6555
50
51LABEL org.opencontainers.image.title="spindle"
52LABEL org.opencontainers.image.description="ci server for tangled"
53LABEL org.opencontainers.image.source="https://tangled.org/sachy.dev/knot-spindle-docker"
54LABEL org.opencontainers.image.url="https://tangled.org"
55LABEL org.opencontainers.image.vendor="tangled.org"
56LABEL org.opencontainers.image.licenses="MIT"
57
58ARG UID=1000
59ARG GID=1000
60
61RUN adduser --system --uid $UID spindle
62RUN addgroup --system --gid $UID spindle
63RUN mkdir -p /app && chown -R spindle:spindle /app
64COPY --from=build-spindle /usr/bin/spindle /usr/bin
65
66WORKDIR /app
67CMD ["spindle"]
68VOLUME ["/app"]
69HEALTHCHECK --interval=60s --timeout=30s --start-period=5s --retries=3 \
70 CMD curl -f http://localhost:6555 || exit 1