Files
evig/Dockerfile.prod
d2662cfe22 chore(pnpm): convert to pnpm 11 (#446)
* chore: pnpm — the fleet has one package manager

- packageManager pnpm@11.25.0; lockfile via pnpm import, package-lock.json gone
- npm overrides moved to pnpm-workspace.yaml overrides (pnpm ignores
  package.json overrides); allowBuilds for @parcel/watcher, @sentry/cli,
  @swc/core, esbuild, puppeteer, unrs-resolver, and the ai-forms git dep
  (pnpm requires the exact resolved URL for git-dep prepare builds)
- @tiptap/core added as a direct dependency: RichTextEditor.tsx augments
  'module @tiptap/core' and tiptap-markdown's Storage augmentation rides on
  it — a phantom dependency npm's hoisting hid and pnpm's isolation exposed
- all workflows: pnpm/action-setup@v6 before setup-node, cache: pnpm,
  store-dir pinned, pnpm install --frozen-lockfile; Next cache key now
  hashes pnpm-lock.yaml
- scripts/ci/dependency-audit.sh: pnpm audit --prod (parses both npm-v2
  'vulnerabilities' and pnpm's v1 'advisories' shapes)
- selfhost-deploy-evig.sh, ship.sh, start-all.sh, e2e-inventory-prod.sh,
  husky pre-commit, Dockerfile.prod (node 24 + corepack) converted
- engines: node >=22.13

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

* fix(deps): declare espree — eslint.config.mjs imports it directly

npm's hoisting provided it as a phantom; pnpm's isolated node_modules
exposed ERR_MODULE_NOT_FOUND in CI. Verified in a true clean room
(parent node_modules masked): full verify green, 7783 tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

* fix(deps): declare tsx — npx fetched it on demand, pnpm exec does not

e2e:seed (and the hirn:*/setup-admins scripts) ran 'npx tsx', which
silently downloaded tsx because it was never in devDependencies. pnpm
exec only resolves installed bins, so CI's Seed E2E step died with
'Command tsx not found'. Declare it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

* fix(ci): drop '--' separators — pnpm run forwards them verbatim

npm strips the first '--' before handing args to the script; pnpm 11
passes it through, so 'pnpm run start -- -p 3001' executed
'next start -- -p 3001' and next read '-p' as a project directory.
pnpm forwards everything after the script name anyway, so the
separator is dead weight: remove it in ci.yml (start, e2e journeys,
e2e guards) and ship.sh.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

---------

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-04 12:06:36 +00:00

68 lines
1.9 KiB
Docker

# Production Dockerfile for RevampIT Next.js Application
FROM node:24-alpine AS base
# corepack activates the pnpm pinned in package.json `packageManager`
RUN corepack enable
# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Copy package files
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
# Install dependencies (build deps too — the builder stage compiles with these)
RUN pnpm install --frozen-lockfile && pnpm store prune
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Copy environment file for build
COPY .env* ./
# Build Next.js application
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_ENV production
# Build the application
RUN pnpm run build
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
# Create a non-root user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Copy the built application
COPY --from=builder /app/public ./public
# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Switch to non-root user
USER nextjs
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1
CMD ["node", "server.js"]