forked from
tangled.org/knot-docker
Community maintained Docker config for the spindle server
1FROM docker.io/golang:1.24-alpine3.21 AS build
2
3ENV CGO_ENABLED=1
4WORKDIR /usr/src/app
5COPY go.mod go.sum ./
6
7RUN apk add --no-cache gcc musl-dev
8RUN go mod download
9
10COPY . .
11RUN go build -v \
12 -o /usr/local/bin/knot \
13 -ldflags='-s -w -extldflags "-static"' \
14 ./cmd/knot
15
16FROM docker.io/alpine:3.21
17
18LABEL org.opencontainers.image.title=Tangled
19LABEL org.opencontainers.image.description="Tangled is a decentralized and open code collaboration platform, built on atproto."
20LABEL org.opencontainers.image.vendor=Tangled.sh
21LABEL org.opencontainers.image.licenses=MIT
22LABEL org.opencontainers.image.url=https://tangled.sh
23LABEL org.opencontainers.image.source=https://tangled.sh/@tangled.sh/core
24
25RUN apk add --no-cache shadow s6-overlay execline openssh git && \
26 adduser --disabled-password git && \
27 # We need to set password anyway since otherwise ssh won't work
28 head -c 32 /dev/random | base64 | tr -dc 'a-zA-Z0-9' | passwd git --stdin && \
29 mkdir /app && mkdir /home/git/repositories
30
31COPY --from=build /usr/local/bin/knot /usr/local/bin
32COPY docker/rootfs/ .
33
34EXPOSE 22
35EXPOSE 5555
36
37ENTRYPOINT ["/bin/sh", "-c", "chown git:git /app && chown git:git /home/git/repositories && /init"]