Files
docker-swarm-termina/frontend/Dockerfile
Claude 1768524969 Fix production stage build failure by using standalone artifacts
The production stage was failing because it tried to build without devDependencies:
- Line 67: npm ci --only=production (excludes TypeScript, Next.js, ESLint)
- Line 70: npm run build (requires devDependencies to build)

This is impossible - you can't build a Next.js app without build tools!

Solution: Use Next.js standalone mode properly
- next.config.ts already has output: 'standalone'
- The e2e-test stage already builds the app at line 52
- Copy the built artifacts instead of rebuilding:
  - .next/standalone/ (self-contained server)
  - .next/static/ (static assets)
  - public/ (public files)
- Run 'node server.js' directly instead of 'npm start'

Benefits:
- No need for npm or node_modules in production
- Smaller production image
- Faster startup (no npm overhead)
- Actually works (doesn't try to build without build tools)

This fixes the docker-build-test failures that occurred because the
production stage was trying to run npm build without TypeScript and
other required devDependencies.

https://claude.ai/code/session_7d4f1b7d-7a0d-44db-b437-c76b6b61dfb2
2026-02-01 22:51:15 +00:00

1.8 KiB