⚠️ Depends on: [BE-01] TypeORM Migrations & Observability Stack — the migration entrypoint and health check must exist before the Docker setup can be finalized.
Overview
The project has no production Dockerfiles, no orchestration for all services, and no automated CI pipelines. Any deployment is currently manual and error-prone. This issue delivers production-ready Dockerfiles for backend and frontend, a docker-compose.prod.yml that runs all four services together, and GitHub Actions workflows that gate every pull request.
Technical Details
1. Backend Dockerfile (backend/Dockerfile)
Multi-stage build:
- Stage 1 (builder):
node:20-alpine, install all deps, run npm run build
- Stage 2 (runner):
node:20-alpine, copy dist/ + prod-only node_modules/, run as non-root user node
- Entrypoint:
sh -c "npm run migration:run && node dist/main.js"
EXPOSE 6006
2. Frontend Dockerfile (frontend/Dockerfile)
Multi-stage build:
- Stage 1 (builder):
node:20-alpine, install deps, run npm run build (Next.js standalone output — add output: 'standalone' to next.config.ts)
- Stage 2 (runner): copy
.next/standalone/ and .next/static/, run as non-root user node
EXPOSE 3000
3. Production Docker Compose (docker-compose.prod.yml)
Four services on a shared freightflow bridge network:
postgres: postgres:15-alpine, persistent named volume, health check using pg_isready
redis: redis:7-alpine, persistent named volume, health check using redis-cli ping
backend: built from ./backend/Dockerfile, depends_on both postgres and redis with condition: service_healthy, all env vars from .env.production
frontend: built from ./frontend/Dockerfile, depends_on backend, env NEXT_PUBLIC_API_URL
- All services:
restart: unless-stopped
4. Backend CI (.github/workflows/backend-ci.yml)
Triggers: pull_request to main
Jobs (run in order):
- Install deps:
npm ci in backend/
- Lint:
npm run lint
- Unit tests:
npm run test
- Build:
npm run build
- Migration dry-run: spin up a
postgres:15 service container and run npm run migration:run
5. Frontend CI (.github/workflows/frontend-ci.yml)
Triggers: pull_request to main
Jobs:
- Install deps:
npm ci in frontend/
- Type-check:
npx tsc --noEmit
- Lint:
npm run lint
- Build:
npm run build
Acceptance Criteria
Overview
The project has no production Dockerfiles, no orchestration for all services, and no automated CI pipelines. Any deployment is currently manual and error-prone. This issue delivers production-ready Dockerfiles for backend and frontend, a
docker-compose.prod.ymlthat runs all four services together, and GitHub Actions workflows that gate every pull request.Technical Details
1. Backend Dockerfile (
backend/Dockerfile)Multi-stage build:
node:20-alpine, install all deps, runnpm run buildnode:20-alpine, copydist/+ prod-onlynode_modules/, run as non-root usernodesh -c "npm run migration:run && node dist/main.js"EXPOSE 60062. Frontend Dockerfile (
frontend/Dockerfile)Multi-stage build:
node:20-alpine, install deps, runnpm run build(Next.js standalone output — addoutput: 'standalone'tonext.config.ts).next/standalone/and.next/static/, run as non-root usernodeEXPOSE 30003. Production Docker Compose (
docker-compose.prod.yml)Four services on a shared
freightflowbridge network:postgres:postgres:15-alpine, persistent named volume, health check usingpg_isreadyredis:redis:7-alpine, persistent named volume, health check usingredis-cli pingbackend: built from./backend/Dockerfile,depends_onboth postgres and redis withcondition: service_healthy, all env vars from.env.productionfrontend: built from./frontend/Dockerfile,depends_onbackend, envNEXT_PUBLIC_API_URLrestart: unless-stopped4. Backend CI (
.github/workflows/backend-ci.yml)Triggers:
pull_requesttomainJobs (run in order):
npm ciinbackend/npm run lintnpm run testnpm run buildpostgres:15service container and runnpm run migration:run5. Frontend CI (
.github/workflows/frontend-ci.yml)Triggers:
pull_requesttomainJobs:
npm ciinfrontend/npx tsc --noEmitnpm run lintnpm run buildAcceptance Criteria
docker build -f backend/Dockerfile backend/completes without errorsdocker build -f frontend/Dockerfile frontend/completes without errorsdocker compose -f docker-compose.prod.yml upbrings all 4 services up healthy