fork of whitequark.org/git-pages with mods for tangled
at main 2.4 kB view raw
1# Install CA certificates. 2FROM docker.io/library/alpine:latest@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 AS ca-certificates-builder 3RUN apk --no-cache add ca-certificates 4 5# Build supervisor. 6FROM docker.io/library/golang:1.25-alpine@sha256:d3f0cf7723f3429e3f9ed846243970b20a2de7bae6a5b66fc5914e228d831bbb AS supervisor-builder 7RUN apk --no-cache add git 8WORKDIR /build 9RUN git clone https://github.com/ochinchina/supervisord . && \ 10 git checkout 16cb640325b3a4962b2ba17d68fb5c2b1e1b6b3c 11RUN GOBIN=/usr/bin go install -ldflags "-s -w" && \ 12 go clean -cache -modcache 13 14# Build Caddy with S3 storage backend. 15FROM docker.io/library/caddy:2.10.2-builder@sha256:6e3ed727ce8695fc58e0a8de8e5d11888f6463c430ea5b40e0b5f679ab734868 AS caddy-builder 16RUN xcaddy build ${CADDY_VERSION} \ 17 --with=github.com/ss098/certmagic-s3@v0.0.0-20250922022452-8af482af5f39 && \ 18 go clean -cache -modcache 19 20# Build git-pages. 21FROM docker.io/library/golang:1.25-alpine@sha256:d3f0cf7723f3429e3f9ed846243970b20a2de7bae6a5b66fc5914e228d831bbb AS git-pages-builder 22RUN apk --no-cache add git 23WORKDIR /build 24COPY go.mod go.sum ./ 25RUN go mod download 26COPY *.go ./ 27COPY src/ ./src/ 28RUN go build -ldflags "-s -w" -o git-pages . && \ 29 go clean -cache -modcache 30 31# Compose git-pages and Caddy. 32FROM docker.io/library/busybox:1.37.0-musl@sha256:ef13e7482851632be3faf5bd1d28d4727c0810901d564b35416f309975a12a30 33COPY --from=ca-certificates-builder /etc/ssl/cert.pem /etc/ssl/cert.pem 34COPY --from=supervisor-builder /usr/bin/supervisord /bin/supervisord 35COPY --from=caddy-builder /usr/bin/caddy /bin/caddy 36COPY --from=git-pages-builder /build/git-pages /bin/git-pages 37 38WORKDIR /app 39RUN mkdir /app/data 40COPY conf/supervisord.conf /app/supervisord.conf 41COPY conf/Caddyfile /app/Caddyfile 42COPY conf/config.example.toml /app/config.toml 43 44# Caddy ports: 45EXPOSE 80/tcp 443/tcp 443/udp 46# git-pages ports: 47EXPOSE 3000/tcp 3001/tcp 3002/tcp 48 49# While the default command is to run git-pages standalone, the intended configuration 50# is to use it with Caddy and store both site data and credentials to an S3-compatible 51# object store. 52# * In a standalone configuration, the default, git-caddy listens on port 3000 (http). 53# * In a combined configuration, supervisord launches both git-caddy and Caddy, and 54# Caddy listens on ports 80 (http) and 443 (https). 55CMD ["git-pages"] 56# CMD ["supervisord"]