Some checks are pending
E2E / Playwright e2e (push) Waiting to run
- Modified .env.example to include PUBLIC_HOST and SECURE variables for better environment management. - Updated Dockerfile to pass PUBLIC_HOST and SECURE as build arguments and set them as environment variables. - Enhanced next.config.mjs to derive public-facing URLs based on PUBLIC_HOST and SECURE, improving flexibility for different deployment environments.
38 lines
890 B
Docker
38 lines
890 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
FROM node:22-alpine AS base
|
|
RUN corepack enable && corepack prepare pnpm@9 --activate
|
|
|
|
FROM base AS deps
|
|
WORKDIR /app
|
|
COPY package.json pnpm-lock.yaml ./
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
ARG PUBLIC_HOST=localhost
|
|
ARG SECURE=
|
|
ENV PUBLIC_HOST=$PUBLIC_HOST
|
|
ENV SECURE=$SECURE
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
RUN pnpm run build
|
|
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
RUN addgroup --system --gid 1001 nodejs \
|
|
&& adduser --system --uid 1001 nextjs
|
|
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
|
USER nextjs
|
|
EXPOSE 3000
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
CMD ["node", "server.js"]
|