feat(devops): improve multi-stage production Dockerfile for NestJS API

- Use pnpm deploy --prod for pruned production node_modules (smaller image)
- Add docker-entrypoint.sh with optional Prisma migration support (RUN_MIGRATIONS)
- Copy generated Prisma client explicitly into production stage
- Add OCI image labels for container registry metadata
- Update .dockerignore: exclude apps/web, libs/ai-services, agent configs, Python artifacts
- Add build directive + RUN_MIGRATIONS env to docker-compose.prod.yml
- Maintain non-root user, dumb-init signal handling, and healthcheck

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-09 01:23:06 +07:00
parent e89cd0ce84
commit 60830d00d0
4 changed files with 79 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ dist
.git
.github
.husky
.gitignore
# Documentation and tests
docs
@@ -30,6 +31,7 @@ playwright-report
coverage
.turbo
.cache
.nx
# OS files
.DS_Store
@@ -37,8 +39,22 @@ Thumbs.db
# Docker files (avoid recursive context)
docker-compose*.yml
Dockerfile*
monitoring
# Dev tools
scripts/backup
*.log
# Python / AI services (not needed for API build)
libs/ai-services
__pycache__
*.pyc
.venv
# Frontend (not needed for API build, has its own Dockerfile)
apps/web
# Agent configs (Paperclip / Claude)
.claude
agents