57 lines
1.6 KiB
Docker
57 lines
1.6 KiB
Docker
# HiveGrid Website — Multi-stage production Docker image
|
|
# Standalone Next.js output for minimal footprint
|
|
|
|
FROM node:22-bookworm-slim AS base
|
|
|
|
LABEL org.opencontainers.image.description="HiveGrid Website — Landing Page"
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
|
|
|
# ── Install dependencies (all, including devDeps for build) ──
|
|
FROM base AS deps
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json ./
|
|
RUN NODE_ENV=development npm ci
|
|
|
|
# ── Build ─────────────────────────────────────────────────────
|
|
FROM base AS build
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
# Git SHA of the deployed commit — baked into the build so the running
|
|
# container advertises its version via the X-Build-SHA response header.
|
|
ARG GIT_SHA=dev
|
|
ENV GIT_SHA=$GIT_SHA
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
RUN npm run build
|
|
|
|
# ── Production ────────────────────────────────────────────────
|
|
FROM base AS production
|
|
|
|
WORKDIR /app
|
|
|
|
# Next.js standalone output
|
|
COPY --from=build /app/.next/standalone ./
|
|
COPY --from=build /app/.next/static ./.next/static
|
|
COPY --from=build /app/public ./public
|
|
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
ARG GIT_SHA=dev
|
|
ENV GIT_SHA=$GIT_SHA
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
CMD curl -f http://localhost:3000/healthz || exit 1
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "server.js"]
|