2026-07-19 01:12:29 +09:00
|
|
|
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
|
|
|
|
|
|
2026-07-17 21:43:03 +09:00
|
|
|
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
|
|
|
|
|
|
2026-07-19 15:21:24 +09:00
|
|
|
RUN cabal build exe:nuthatch exe:nuthatch-storage-integration exe:nuthatch-recovery-probe exe:nuthatch-protocol-conformance exe:nuthatch-runtime-probe \
|
2026-07-17 21:43:03 +09:00
|
|
|
&& mkdir -p /out \
|
2026-07-18 15:22:57 +09:00
|
|
|
&& cp "$(cabal list-bin exe:nuthatch)" /out/nuthatch \
|
2026-07-19 15:21:24 +09:00
|
|
|
&& 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
|
2026-07-17 21:43:03 +09:00
|
|
|
|
2026-07-18 15:22:57 +09:00
|
|
|
FROM debian:bookworm-slim AS runtime-base
|
2026-07-17 21:43:03 +09:00
|
|
|
|
|
|
|
|
RUN apt-get update \
|
|
|
|
|
&& apt-get install -y --no-install-recommends \
|
|
|
|
|
libpq5 \
|
|
|
|
|
ca-certificates \
|
|
|
|
|
curl \
|
2026-07-18 18:08:41 +09:00
|
|
|
openssl \
|
2026-07-18 16:16:24 +09:00
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
|
|
|
&& groupadd --system --gid 10001 nuthatch \
|
|
|
|
|
&& useradd --system --uid 10001 --gid 10001 --no-create-home nuthatch
|
2026-07-17 21:43:03 +09:00
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
COPY sql ./sql
|
2026-07-19 01:12:29 +09:00
|
|
|
COPY --from=frontend /web/dist ./web/dist
|
2026-07-18 16:16:24 +09:00
|
|
|
USER 10001:10001
|
2026-07-17 21:43:03 +09:00
|
|
|
|
2026-07-18 15:22:57 +09:00
|
|
|
FROM runtime-base AS test-runtime
|
|
|
|
|
|
|
|
|
|
COPY --from=build /out/nuthatch /usr/local/bin/nuthatch
|
2026-07-19 15:21:24 +09:00
|
|
|
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
|
2026-07-18 22:49:19 +09:00
|
|
|
CMD ["nuthatch"]
|
2026-07-18 15:22:57 +09:00
|
|
|
|
|
|
|
|
FROM runtime-base AS runtime
|
|
|
|
|
|
|
|
|
|
COPY --from=build /out/nuthatch /usr/local/bin/nuthatch
|
|
|
|
|
|
2026-07-17 21:43:03 +09:00
|
|
|
EXPOSE 8080
|
|
|
|
|
CMD ["nuthatch"]
|