Fare and route-coach, production checklist updates

This commit is contained in:
Stephanos A
2026-07-02 22:42:15 +03:00
parent 4aadf588d4
commit 200476dfd6
37 changed files with 1672 additions and 248 deletions

View File

@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1
#
# Next.js Dockerfile for passenger web (portal + backoffice).
# Builds with turbo, runs with Node.js (not nginx).
# Builds with turbo, runs with Node.js standalone output.
#
# Build example (portal):
# DOCKER_BUILDKIT=1 docker build \
@@ -16,8 +16,6 @@ ARG PORT=5174
ARG NEXT_PUBLIC_API_URL
FROM node:24.15.0-alpine AS base
RUN apk add --no-cache libc6-compat
# Store pnpm's content-addressable store under PNPM_HOME so the BuildKit
# `--mount=type=cache,target=/pnpm/store` cache actually persists deps across builds.
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
@@ -46,20 +44,30 @@ RUN if [ -z "$NEXT_PUBLIC_API_URL" ]; then \
COPY --from=installer /app/ .
COPY --from=pruner /app/out/full/ .
RUN pnpm turbo build --filter="${APP_PACKAGE}..."
FROM base AS deployer
ARG APP_PACKAGE
COPY --from=builder /app/ .
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm deploy --filter="${APP_PACKAGE}" --prod --legacy /deploy
# Runner: copy the standalone output produced by Next.js.
# With output:'standalone' in a pnpm monorepo, Next.js emits:
# .next/standalone/ <- shared workspace node_modules
# .next/standalone/<APP_PATH>/ <- app server.js + app-level node_modules
# .next/static/ <- hashed client assets
# public/ <- static public files
# We copy the full standalone tree to /app, then WORKDIR into the app
# subdirectory so `node server.js` resolves correctly.
FROM node:24.15.0-alpine AS runner
ARG APP_PATH
ARG PORT=5174
ENV PORT=${PORT}
ENV NODE_ENV=production
WORKDIR /app
COPY --from=deployer /deploy .
COPY --from=builder /app/${APP_PATH}/.next .next
COPY --from=builder /app/${APP_PATH}/public public
USER node
RUN addgroup --system --gid 1001 nodejs \
&& adduser --system --uid 1001 --ingroup nodejs nextjs
# Copy the entire standalone tree (includes root node_modules symlinks)
COPY --from=builder --chown=nextjs:nodejs /app/${APP_PATH}/.next/standalone ./
# Overlay the hashed static assets and public files at the path Next.js expects
COPY --from=builder --chown=nextjs:nodejs /app/${APP_PATH}/.next/static ./${APP_PATH}/.next/static
COPY --from=builder --chown=nextjs:nodejs /app/${APP_PATH}/public ./${APP_PATH}/public
USER nextjs
# server.js lives at <APP_PATH>/server.js inside the standalone tree
WORKDIR /app/${APP_PATH}
EXPOSE ${PORT}
CMD ["npx", "next", "start"]
CMD ["node", "server.js"]