nuthatch/Dockerfile
ms2k 15eb0038d2 Replace planning-era names and squash initial schema
Use descriptive test and executable names so implementation surfaces do not depend on journal organization. Consolidate the unreleased migration history into the authoritative initial schema because no deployed database requires an upgrade path.
2026-07-19 15:21:24 +09:00

69 lines
2.1 KiB
Docker

FROM node:24.18.0-bookworm-slim AS frontend
WORKDIR /web
COPY web/package.json web/package-lock.json ./
RUN npm ci
COPY web ./
RUN npm test && npm run check && npm run build
FROM haskell:9.10.3-slim-bookworm AS build
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libpq-dev \
pkg-config \
zlib1g-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY nuthatch.cabal cabal.project ./
RUN cabal update \
&& cabal build --only-dependencies all
COPY sql ./sql
COPY app ./app
COPY src ./src
COPY test ./test
RUN cabal build exe:nuthatch exe:nuthatch-storage-integration exe:nuthatch-recovery-probe exe:nuthatch-protocol-conformance exe:nuthatch-runtime-probe \
&& mkdir -p /out \
&& cp "$(cabal list-bin exe:nuthatch)" /out/nuthatch \
&& cp "$(cabal list-bin exe:nuthatch-storage-integration)" /out/nuthatch-storage-integration \
&& cp "$(cabal list-bin exe:nuthatch-recovery-probe)" /out/nuthatch-recovery-probe \
&& cp "$(cabal list-bin exe:nuthatch-protocol-conformance)" /out/nuthatch-protocol-conformance \
&& cp "$(cabal list-bin exe:nuthatch-runtime-probe)" /out/nuthatch-runtime-probe
FROM debian:bookworm-slim AS runtime-base
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libpq5 \
ca-certificates \
curl \
openssl \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd --system --gid 10001 nuthatch \
&& useradd --system --uid 10001 --gid 10001 --no-create-home nuthatch
WORKDIR /app
COPY sql ./sql
COPY --from=frontend /web/dist ./web/dist
USER 10001:10001
FROM runtime-base AS test-runtime
COPY --from=build /out/nuthatch /usr/local/bin/nuthatch
COPY --from=build /out/nuthatch-storage-integration /usr/local/bin/nuthatch-storage-integration
COPY --from=build /out/nuthatch-recovery-probe /usr/local/bin/nuthatch-recovery-probe
COPY --from=build /out/nuthatch-protocol-conformance /usr/local/bin/nuthatch-protocol-conformance
COPY --from=build /out/nuthatch-runtime-probe /usr/local/bin/nuthatch-runtime-probe
CMD ["nuthatch"]
FROM runtime-base AS runtime
COPY --from=build /out/nuthatch /usr/local/bin/nuthatch
EXPOSE 8080
CMD ["nuthatch"]