2026-07-30 12:14:24 +07:00
|
|
|
# ---- Builder stage: Next.js static export ----
|
|
|
|
|
FROM node:22-slim AS builder
|
2026-07-04 03:03:36 +07:00
|
|
|
|
2026-07-30 12:14:24 +07:00
|
|
|
WORKDIR /build
|
2026-07-04 03:03:36 +07:00
|
|
|
|
2026-07-30 13:18:44 +07:00
|
|
|
RUN npm install -g pnpm@10
|
2026-07-04 03:03:36 +07:00
|
|
|
|
2026-07-30 13:18:44 +07:00
|
|
|
# Build essentials (native deps like sharp need g++)
|
2026-07-27 21:54:31 +07:00
|
|
|
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \
|
2026-07-30 12:14:24 +07:00
|
|
|
make g++ \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2026-07-04 03:03:36 +07:00
|
|
|
|
2026-07-30 13:18:44 +07:00
|
|
|
# Copy source + manifests
|
2026-07-30 12:14:24 +07:00
|
|
|
COPY services/frontend/ ./
|
2026-07-27 21:54:31 +07:00
|
|
|
|
2026-07-30 13:18:44 +07:00
|
|
|
# Install all deps
|
|
|
|
|
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
|
|
|
|
|
pnpm install --no-frozen-lockfile
|
2026-07-27 21:54:31 +07:00
|
|
|
|
2026-07-30 12:14:24 +07:00
|
|
|
# Build static export
|
2026-07-30 13:18:44 +07:00
|
|
|
RUN pnpm run build
|
2026-07-27 21:54:31 +07:00
|
|
|
|
2026-07-30 12:14:24 +07:00
|
|
|
# ---- Runtime stage: nginx ----
|
2026-06-02 08:36:34 +07:00
|
|
|
FROM nginx:alpine
|
|
|
|
|
|
2026-06-02 09:26:47 +07:00
|
|
|
COPY infra/docker/nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
2026-07-30 12:14:24 +07:00
|
|
|
COPY --from=builder /build/out/ /usr/share/nginx/html/
|
2026-07-04 03:03:36 +07:00
|
|
|
|
2026-06-02 08:36:34 +07:00
|
|
|
EXPOSE 80
|
|
|
|
|
|
2026-07-27 21:54:31 +07:00
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
|
|
|
CMD wget -qO- http://localhost:80/ || exit 1
|
|
|
|
|
|
2026-06-02 08:36:34 +07:00
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|