0
Write a production-ready Dockerfile and CI pipeline with reasoning for each choice
Write a Dockerfile and a CI pipeline config ({{ci_system, e.g. GitHub Actions}}) for {{project_type, e.g. a Node/TypeScript API}}. For every non-obvious choice, add a comment explaining why, not just what. Requirements:
1. Multi-stage build: separate build and runtime stages, runtime image should not contain build tools or dev dependencies.
2. Layer caching: order instructions so dependency installation is cached separately from source code copies.
3. Run as a non-root user in the final image.
4. Pin base image versions (no `latest`), and explain the tradeoff if I should consider a distroless or alpine variant given this project's dependencies.
5. CI pipeline: lint, type-check, test, build image, in that order with fail-fast, and cache dependencies between runs.
6. Include a health check appropriate to the project type.
7. Flag anything project-specific I need to fill in (native dependencies that need extra system packages, etc.) rather than silently guessing.
Project details: project_details