Skip to content

[DevOps] Containerize backend with Docker & Compose - #45

Open
Richardkingz2019 wants to merge 1 commit into
EquipChain:mainfrom
Richardkingz2019:devops/dockerize-backend
Open

[DevOps] Containerize backend with Docker & Compose#45
Richardkingz2019 wants to merge 1 commit into
EquipChain:mainfrom
Richardkingz2019:devops/dockerize-backend

Conversation

@Richardkingz2019

@Richardkingz2019 Richardkingz2019 commented Jul 30, 2026

Copy link
Copy Markdown

Closes #10
n## Summary

Adds production-grade containerization for the EquipChain backend using a Docker multi-stage build and a Docker Compose stack (API + Redis) for local development and reproducible deployments.\n\n

What changed\

Docker multi-stage build:
Builder stage installs full dependencies and runs the test suite (npm test) during image build.\n - Production stage installs only production dependencies (npm ci --omit=dev), sets NODE_ENV=production, and runs as the non-root node user

. Docker Compose stack:\n - api service built from the production target, published on port 3000, and configured via environment variables (supports overriding via a local .env file).\n - redis service using redis:7-alpine with a persistent named volume.

Healthchecks for both api (/api/health) and redis (redis-cli ping) plus an isolated named bridge network.

Development override:\n - docker-compose.override.yml enables bind-mounting the working tree and uses node --watch for a simple edit/restart loop without extra dependencies.

Build context cleanup:\n - .dockerignore excludes node_modules, git metadata, env files, and other non-essential paths to keep Docker builds fast and deterministic.\n- Documentation:

README updated with Docker/Compose usage and helper scripts.\n\n## How to run

Build and run the production image:\n - docker build -t equipchain-backend:local .

  • docker run --rm -p 3000:3000 --env-file .env equipchain-backend:local\n- Run API + Redis via Compose:\n - docker compose up --build

-n## Local verification\n- npm ci\n- npm test\n- npx eslint .

closes #10

@KarenZita01

Copy link
Copy Markdown
Member

Failed CI. Try an fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DevOps] Containerize Application with Docker Multi-Stage Build and Docker Compose

3 participants