Problem Statement
The CI pipeline docker-build-pipeline.yml references a Dockerfile at docker/backend.Dockerfile with three build targets (build, test, production), but this file does not exist on disk. The entire Docker image pipeline is broken.
Evidence
infrastructure/ci/docker-build-pipeline.yml — References docker/backend.Dockerfile
docker/backend.Dockerfile — FILE_DOES_NOT_EXIST
docker/frontend.Dockerfile — FILE_DOES_NOT_EXIST
docker/docker-compose.yml — FILE_DOES_NOT_EXIST
Impact
CI/CD pipeline is broken — Docker images cannot be built or deployed. The build, test, security-scan, and push jobs all fail.
Proposed Solution
Create a multi-stage Dockerfile at docker/backend.Dockerfile with:
build stage: install deps, run nest build
test stage: install dev deps, run tests with coverage
production stage: copy compiled output, install production deps only, run with node user
Technical Requirements
- Must use Node.js 20 as base image
- Must use distroless or alpine for production stage
- Must not run as root in production
- Must support the target names used by CI: build, test, production
- Must include healthcheck instruction
Acceptance Criteria
docker build --target build -f docker/backend.Dockerfile . succeeds
docker build --target test -f docker/backend.Dockerfile . succeeds and runs tests
docker build --target production -f docker/backend.Dockerfile . produces <200MB image
- Production container starts and responds on port 3000
- Production container runs as non-root user
- CI docker-build-pipeline.yml passes with the new Dockerfile
File Inventory
docker/backend.Dockerfile (new)
docker/.dockerignore (new, recommended)
Dependencies
None.
Testing Strategy
- CI build job should succeed
- Security scan should pass with no critical/high vulnerabilities
- Manual verification that production container starts and responds
Security Considerations
- Use non-root user in production
- Minimal base image to reduce attack surface
- Do not include dev dependencies or source code in production image
Definition of Done
Problem Statement
The CI pipeline
docker-build-pipeline.ymlreferences a Dockerfile atdocker/backend.Dockerfilewith three build targets (build, test, production), but this file does not exist on disk. The entire Docker image pipeline is broken.Evidence
infrastructure/ci/docker-build-pipeline.yml— References docker/backend.Dockerfiledocker/backend.Dockerfile— FILE_DOES_NOT_EXISTdocker/frontend.Dockerfile— FILE_DOES_NOT_EXISTdocker/docker-compose.yml— FILE_DOES_NOT_EXISTImpact
CI/CD pipeline is broken — Docker images cannot be built or deployed. The build, test, security-scan, and push jobs all fail.
Proposed Solution
Create a multi-stage Dockerfile at docker/backend.Dockerfile with:
buildstage: install deps, run nest buildteststage: install dev deps, run tests with coverageproductionstage: copy compiled output, install production deps only, run with node userTechnical Requirements
Acceptance Criteria
docker build --target build -f docker/backend.Dockerfile .succeedsdocker build --target test -f docker/backend.Dockerfile .succeeds and runs testsdocker build --target production -f docker/backend.Dockerfile .produces <200MB imageFile Inventory
docker/backend.Dockerfile(new)docker/.dockerignore(new, recommended)Dependencies
None.
Testing Strategy
Security Considerations
Definition of Done