Description: Write a production-ready, multi-stage Dockerfile to containerize the Node.js API, alongside a docker-compose.yml file that orchestrates the API, PostgreSQL, and Redis for seamless local development natively on Linux environments.
Context / Motivation: "It works on my machine" is an anti-pattern. We need a reproducible, containerized setup so new contributors can spin up the entire backend stack with a single docker compose up command.
Acceptance Criteria: - [ ] Create a Dockerfile that builds the TS code in an initial stage, then copies only the compiled JS and production dependencies into a lightweight runtime image (e.g., node:20-alpine).
Description: Write a production-ready, multi-stage
Dockerfileto containerize the Node.js API, alongside adocker-compose.ymlfile that orchestrates the API, PostgreSQL, and Redis for seamless local development natively on Linux environments.Context / Motivation: "It works on my machine" is an anti-pattern. We need a reproducible, containerized setup so new contributors can spin up the entire backend stack with a single
docker compose upcommand.Acceptance Criteria: - [ ] Create a
Dockerfilethat builds the TS code in an initial stage, then copies only the compiled JS and production dependencies into a lightweight runtime image (e.g.,node:20-alpine).docker-compose.ymllinking the API service topostgres:15andredis:7containers.Technical Pointers: Pay close attention to
.dockerignore. Preventnode_modulesand local.envfiles from being copied into the build context. Ensure the API container awaits the database startup before attempting connection.