Skip to content

[DevOps] Containerization: Multi-Stage Dockerfile & Local Development Stack #173

Description

@AlAfiz

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).

  • Create a docker-compose.yml linking the API service to postgres:15 and redis:7 containers.
  • Map persistent volumes correctly so database data survives container restarts.
    Technical Pointers: Pay close attention to .dockerignore. Prevent node_modules and local .env files from being copied into the build context. Ensure the API container awaits the database startup before attempting connection.

Metadata

Metadata

Assignees

Labels

DevopsGrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaignhelp wantedExtra attention is needed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions