Community maintained Docker config for the spindle server

Compare changes

Choose any two refs to compare.

Changed files
+34 -81
rootfs
etc
s6-overlay
s6-rc.d
create-sshd-host-keys
knotserver
dependencies.d
run
spindleserver
dependencies.d
run
sshd
user
scripts
ssh
+15 -15
Dockerfile
···
FROM golang:1.24-alpine AS builder
-
ENV KNOT_REPO_SCAN_PATH=/home/git/repositories
ENV CGO_ENABLED=1
ARG TAG='v1.10.0-alpha'
···
WORKDIR /app
RUN apk add git gcc musl-dev
RUN git clone -b ${TAG} https://tangled.org/@tangled.org/core .
-
RUN go build -o /usr/bin/knot -ldflags '-s -w -extldflags "-static"' ./cmd/knot
FROM alpine:edge
-
EXPOSE 5555
-
EXPOSE 22
-
LABEL org.opencontainers.image.title='knot'
-
LABEL org.opencontainers.image.description='data server for tangled'
-
LABEL org.opencontainers.image.source='https://tangled.org/@tangled.org/knot-docker'
LABEL org.opencontainers.image.url='https://tangled.org'
LABEL org.opencontainers.image.vendor='tangled.org'
LABEL org.opencontainers.image.licenses='MIT'
···
COPY rootfs .
RUN chmod 755 /etc
RUN chmod -R 755 /etc/s6-overlay
-
RUN apk add shadow s6-overlay execline openssl openssh git curl bash
-
RUN groupadd -g $GID -f git
-
RUN useradd -u $UID -g $GID -d /home/git git
-
RUN openssl rand -hex 16 | passwd --stdin git
-
RUN mkdir -p /home/git/repositories && chown -R git:git /home/git
-
COPY --from=builder /usr/bin/knot /usr/bin
-
RUN mkdir /app && chown -R git:git /app
HEALTHCHECK --interval=60s --timeout=30s --start-period=5s --retries=3 \
-
cmd curl -f http://localhost:5555 || exit 1
ENTRYPOINT ["/init"]
···
FROM golang:1.24-alpine AS builder
ENV CGO_ENABLED=1
ARG TAG='v1.10.0-alpha'
···
WORKDIR /app
RUN apk add git gcc musl-dev
RUN git clone -b ${TAG} https://tangled.org/@tangled.org/core .
+
RUN go build -o /usr/bin/spindle -ldflags '-s -w -extldflags "-static"' ./cmd/spindle
FROM alpine:edge
+
+
ARG PORT=6555
+
EXPOSE $PORT
+
LABEL org.opencontainers.image.title='spindle'
+
LABEL org.opencontainers.image.description='CI runner for tangled'
+
LABEL org.opencontainers.image.source='https://tangled.org/@keea.dog/spindle-docker'
LABEL org.opencontainers.image.url='https://tangled.org'
LABEL org.opencontainers.image.vendor='tangled.org'
LABEL org.opencontainers.image.licenses='MIT'
···
COPY rootfs .
RUN chmod 755 /etc
RUN chmod -R 755 /etc/s6-overlay
+
RUN apk add shadow s6-overlay execline openssl curl
+
RUN groupadd -g $GID -f spindle
+
RUN useradd -u $UID -g $GID -d /home/spindle spindle
+
RUN openssl rand -hex 16 | passwd --stdin spindle
+
RUN mkdir -p /home/spindle/repositories && chown -R spindle:spindle /home/spindle
+
COPY --from=builder /usr/bin/spindle /usr/bin
+
RUN mkdir /app && chown -R spindle:spindle /app
HEALTHCHECK --interval=60s --timeout=30s --start-period=5s --retries=3 \
+
CMD curl -f http://localhost:${PORT} || exit 1
ENTRYPOINT ["/init"]
+15 -15
docker-compose.yml
···
services:
-
knot:
build:
context: .
args:
UID: 1000
GID: 1000
environment:
-
KNOT_SERVER_HOSTNAME: ${KNOT_SERVER_HOSTNAME}
-
KNOT_SERVER_OWNER: ${KNOT_SERVER_OWNER}
-
KNOT_SERVER_DB_PATH: /app/knotserver.db
-
KNOT_REPO_SCAN_PATH: /home/git/repositories
-
KNOT_SERVER_INTERNAL_LISTEN_ADDR: localhost:5444
volumes:
-
- ./keys:/etc/ssh/keys
-
- ./repositories:/home/git/repositories
- ./server:/app
ports:
-
- "5555:5555"
-
- "2222:22"
restart: always
frontend:
image: caddy:alpine
command: >
caddy
reverse-proxy
-
--from ${KNOT_SERVER_HOSTNAME}
-
--to knot:5555
depends_on:
-
- knot
ports:
-
- ${KNOT_SERVER_PORT:-443}:443
-
- ${KNOT_SERVER_PORT:-443}:443/udp
volumes:
- ./caddy_data:/data
restart: always
···
services:
+
spindle:
build:
context: .
args:
UID: 1000
GID: 1000
+
PORT: ${INTERNAL_PORT:-6555}
environment:
+
SPINDLE_SERVER_HOSTNAME: ${SPINDLE_SERVER_HOSTNAME}
+
SPINDLE_SERVER_OWNER: ${SPINDLE_SERVER_OWNER}
+
SPINDLE_SERVER_DB_PATH: /app/spindle.db
+
SPINDLE_SERVER_LISTEN_ADDR: localhost:6555
+
SPINDLE_PIPELINES_LOG_DIR: /var/log/spindle
+
PORT: ${INTERNAL_PORT:-6555}
volumes:
- ./server:/app
+
- /var/run/docker.sock:/var/run/docker.sock
ports:
+
- "${INTERNAL_PORT:-6555}:${INTERNAL_PORT:-6555}"
restart: always
frontend:
image: caddy:alpine
command: >
caddy
reverse-proxy
+
--from ${SPINDLE_SERVER_HOSTNAME}
+
--to spindle:6555
depends_on:
+
- spindle
ports:
+
- ${SPINDLE_SERVER_PORT:-443}:443
+
- ${SPINDLE_SERVER_PORT:-443}:443/udp
volumes:
- ./caddy_data:/data
restart: always
-1
rootfs/etc/s6-overlay/s6-rc.d/create-sshd-host-keys/type
···
-
oneshot
···
-1
rootfs/etc/s6-overlay/s6-rc.d/create-sshd-host-keys/up
···
-
/etc/s6-overlay/scripts/create-sshd-host-keys
···
rootfs/etc/s6-overlay/s6-rc.d/knotserver/dependencies.d/base

This is a binary file and will not be displayed.

-3
rootfs/etc/s6-overlay/s6-rc.d/knotserver/run
···
-
#!/command/with-contenv ash
-
-
exec s6-setuidgid git /usr/bin/knot server
···
-1
rootfs/etc/s6-overlay/s6-rc.d/knotserver/type
···
-
longrun
···
rootfs/etc/s6-overlay/s6-rc.d/spindleserver/dependencies.d/base

This is a binary file and will not be displayed.

+3
rootfs/etc/s6-overlay/s6-rc.d/spindleserver/run
···
···
+
#!/command/with-contenv ash
+
+
exec s6-setuidgid spindle /usr/bin/spindle server
+1
rootfs/etc/s6-overlay/s6-rc.d/spindleserver/type
···
···
+
longrun
rootfs/etc/s6-overlay/s6-rc.d/sshd/dependencies.d/base

This is a binary file and will not be displayed.

rootfs/etc/s6-overlay/s6-rc.d/sshd/dependencies.d/create-sshd-host-keys

This is a binary file and will not be displayed.

-3
rootfs/etc/s6-overlay/s6-rc.d/sshd/run
···
-
#!/usr/bin/execlineb -P
-
-
/usr/sbin/sshd -e -D
···
-1
rootfs/etc/s6-overlay/s6-rc.d/sshd/type
···
-
longrun
···
rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/knotserver

This is a binary file and will not be displayed.

rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/spindleserver

This is a binary file and will not be displayed.

rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/sshd

This is a binary file and will not be displayed.

-21
rootfs/etc/s6-overlay/scripts/create-sshd-host-keys
···
-
#!/usr/bin/execlineb -P
-
-
foreground {
-
if -n { test -d /etc/ssh/keys }
-
mkdir /etc/ssh/keys
-
}
-
-
foreground {
-
if -n { test -f /etc/ssh/keys/ssh_host_rsa_key }
-
ssh-keygen -t rsa -f /etc/ssh/keys/ssh_host_rsa_key -q -N ""
-
}
-
-
foreground {
-
if -n { test -f /etc/ssh/keys/ssh_host_ecdsa_key }
-
ssh-keygen -t rsa -f /etc/ssh/keys/ssh_host_ecdsa_key -q -N ""
-
}
-
-
foreground {
-
if -n { test -f /etc/ssh/keys/ssh_host_ed25519_key }
-
ssh-keygen -t rsa -f /etc/ssh/keys/ssh_host_ed25519_key -q -N ""
-
}
···
-8
rootfs/etc/s6-overlay/scripts/keys-wrapper
···
-
#!/bin/sh
-
-
# Execute the knot keys command with proper shell context
-
exec /bin/sh -c '/usr/bin/knot keys -output authorized-keys \
-
-internal-api "http://${KNOT_SERVER_INTERNAL_LISTEN_ADDR:-localhost:5444}" \
-
-git-dir "${KNOT_REPO_SCAN_PATH:-/home/git/repositories}" \
-
-log-path "/tmp/knotguard.log"'
-
···
-3
rootfs/etc/ssh/sshd_config.d/authorized_keys_command.conf
···
-
Match User git
-
AuthorizedKeysCommand /usr/bin/knot keys -o authorized-keys -git-dir /home/git/repositories
-
AuthorizedKeysCommandUser nobody
···
-9
rootfs/etc/ssh/sshd_config.d/tangled_sshd.conf
···
-
HostKey /etc/ssh/keys/ssh_host_rsa_key
-
HostKey /etc/ssh/keys/ssh_host_ecdsa_key
-
HostKey /etc/ssh/keys/ssh_host_ed25519_key
-
-
PasswordAuthentication no
-
-
Match User git
-
AuthorizedKeysCommand /etc/s6-overlay/scripts/keys-wrapper
-
AuthorizedKeysCommandUser nobody
···