Skip to content
1        10        20        30        40        50        60        70        80        90        1001# syntax=docker/dockerfile:123# Build stage: Zig compiler, then the vendored DuckDB static archives. Everything4# C and C++ is linked into the binary, so the runtime image needs neither5# libduckdb.so nor a C++ toolchain.6FROM debian:bookworm-slim AS build78ARG ZIG_VERSION=0.14.19ARG DUCKDB_VERSION=2.0.01011RUN apt-get update \12 && apt-get install -y --no-install-recommends ca-certificates curl xz-utils \13 && rm -rf /var/lib/apt/lists/*1415RUN curl -fsSL "https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz" \16  | tar -xJ -C /opt \17 && ln -s "/opt/zig-x86_64-linux-${ZIG_VERSION}/zig" /usr/local/bin/zig1819WORKDIR /src20COPY build.zig build.zig.zon ./21COPY scripts ./scripts22COPY src ./src23RUN DUCKDB_VERSION="${DUCKDB_VERSION}" ./scripts/fetch-duckdb.sh \24 && zig build -Doptimize=ReleaseSafe --prefix /out2526# Runtime stage: the single binary and a CA bundle, nothing else.27FROM debian:bookworm-slim2829LABEL remote="silenloc/totenschloss" \30      ino.deploy.server="https://ino.silenlocatelli.ch" \31      ino.deploy.host="totenschloss.silenlocatelli.ch"3233RUN apt-get update \34 && apt-get install -y --no-install-recommends ca-certificates libcap2-bin \35 && rm -rf /var/lib/apt/lists/*3637COPY --from=build /out/bin/totenschloss /usr/local/bin/totenschloss3839# Listen on port 80 without root. Persistent data (DuckDB extension cache, spill files) lives in /storage.40RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/totenschloss \41 && useradd --system --home-dir /storage --shell /usr/sbin/nologin totenschloss \42 && mkdir -p /storage \43 && chown totenschloss:totenschloss /storage4445USER totenschloss46ENV PORT=80 \47    STORAGE_PATH=/storage48VOLUME ["/storage"]49EXPOSE 805051CMD ["totenschloss"]