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-18 22:49:19 +09:00
|
|
|
RUN cabal build exe:nuthatch exe:nuthatch-wp04-integration exe:nuthatch-wp09-phase \
|
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-18 22:49:19 +09:00
|
|
|
&& cp "$(cabal list-bin exe:nuthatch-wp04-integration)" /out/nuthatch-wp04-integration \
|
|
|
|
|
&& cp "$(cabal list-bin exe:nuthatch-wp09-phase)" /out/nuthatch-wp09-phase
|
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-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
|
|
|
|
|
COPY --from=build /out/nuthatch-wp04-integration /usr/local/bin/nuthatch-wp04-integration
|
2026-07-18 22:49:19 +09:00
|
|
|
COPY --from=build /out/nuthatch-wp09-phase /usr/local/bin/nuthatch-wp09-phase
|
|
|
|
|
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"]
|