# Runtime image for pds.zat.dev. CI builds the binaries before deploying, so # the context is bin/ plus the two files tools/fly-deploy.sh stages beside it; # the Dockerfile beside this one builds from source. # Both share the runtime stages below, so keep them the same. # Litestream streams the database to a bucket when ZDS_LITESTREAM_BUCKET is # set (docs/backups.md). Pinned by digest: the 0.5.18 multi-arch index. FROM litestream/litestream:0.5.18@sha256:513bff62a88fc0c86c73d27333c41c54c89fe890a7c32a551600adff9309b11b AS litestream # The runtime image has glibc and a busybox shell, and nothing else zds needs. # This stage supplies the rest from Debian: the CA bundle, held to the trust # floor in docs/tls-trust.md, and the sqlite3 shell the runbooks use, with the # libraries it needs beyond the C library. FROM debian:bookworm-slim AS runtime-files ARG CA_CERTIFICATES_MIN_VERSION=20250419~deb12u2 RUN apt-get update \ && apt-get install -y --no-install-recommends ca-certificates sqlite3 \ && dpkg --compare-versions "$(dpkg-query -W -f='${Version}' ca-certificates)" ge "$CA_CERTIFICATES_MIN_VERSION" \ && rm -rf /var/lib/apt/lists/* RUN set -eux; \ mkdir -p /out/data /out/bin /out/etc/ssl/certs; \ cp /etc/ssl/certs/ca-certificates.crt /out/etc/ssl/certs/; \ cp --parents /usr/bin/sqlite3 /out; \ ldd /usr/bin/sqlite3 | awk '$3 ~ /^\// { print $3 }' \ | grep -Ev '/(libc|libm|libpthread|libdl|librt|libresolv)\.so|/ld-linux' \ | xargs -r cp --parents -L -t /out; \ ln -s /busybox/sh /out/bin/sh # distroless base-debian12:debug, pinned. Moving the pin is a deliberate change. FROM gcr.io/distroless/base-debian12:debug@sha256:0a5b69081973d7069cbeab49c24851dd517887767e934fc8e6f808ea08770ef4 COPY --from=runtime-files /out/ / COPY bin/ /usr/local/bin/ COPY --from=litestream /usr/local/bin/litestream /usr/local/bin/litestream COPY litestream.yml /etc/zds/litestream.yml COPY container-start.sh /usr/local/bin/zds-start ENV ZDS_HOST=0.0.0.0 ENV ZDS_PORT=2583 ENV ZDS_DB=/data/zds.sqlite3 WORKDIR /app EXPOSE 2583 ENTRYPOINT [] CMD ["zds-start"]