[DevOps] Containerize backend with Docker & Compose - #45
Open
Richardkingz2019 wants to merge 1 commit into
Open
Conversation
Member
|
Failed CI. Try an fix it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 .
-n## Local verification\n- npm ci\n- npm test\n- npx eslint .
closes #10