feat: add Docker support for one-command local setup #47
Open
adarsh-7-satyam wants to merge 2 commits into
Open
feat: add Docker support for one-command local setup #47adarsh-7-satyam wants to merge 2 commits into
adarsh-7-satyam wants to merge 2 commits into
Conversation
Signed-off-by: Adarsh Satyam <adarsh5.satyam@gmail.com>
Signed-off-by: Adarsh Satyam <adarsh5.satyam@gmail.com>
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 #45
Problem
Setting up this project locally requires contributors to manually install Python 3.8+, Node.js 18+, create a virtual environment, and run
bash.sh— which doesn't work on Windows without WSL. Version mismatches cause hard-to-reproduce environment-specific bugs, creating friction especially during high-volume programs like DMP 2026.Solution
This PR adds full Docker Compose support so any contributor can get the
entire stack running with:
Frontend → http://localhost:3000
Backend → http://localhost:5000
Files Added
docker-compose.ymlbackend/Dockerfilefrontend/Dockerfilebackend/.env.example.dockerignoreCode Changes
backend/app.pyGET /healthroute required by Docker healthcheckfrontend/services/api.tsNEXT_PUBLIC_API_URLenv var with fallback to127.0.0.1:5000so bare-metal workflow is unchangedDesign Decisions
HuggingFace model cache —
facebook/bart-large-mnliandsentence-transformers/all-MiniLM-L6-v2are large models that download at runtime. A named volumehf-model-cachepersists them across container restarts so they download only once.Flask bound to
0.0.0.0— Flask defaults to127.0.0.1which is unreachable from outside the container. The backend Dockerfile usesflask run --host=0.0.0.0to make it accessible on the Docker network.Volume mounts for live reload — Source directories are mounted so code edits reflect immediately without rebuilding the image. Anonymous volumes guard
node_modulesand__pycache__from being shadowed by the host.depends_onwith healthcheck — The frontend waits for the backend/healthroute to return 200 before starting, preventing cold-start race conditions.Non-breaking fallback in api.ts — The
??operator means contributors not using Docker get the same127.0.0.1:5000behaviour as before. Zero regression for existing workflow.Testing Done
Tested locally on Windows 11 with Docker Desktop 27.4.0:
Level 1 — file verification
/healthroute confirmed in backend/app.py line 17NEXT_PUBLIC_API_URLconfirmed in frontend/services/api.ts line 8Level 2 — image builds
docker build -t unsdg-backend ./backend— 6/6 steps FINISHEDdocker build -t unsdg-frontend ./frontend— 12/12 steps FINISHEDLevel 3 — full stack smoke test
curl http://localhost:5000/health→{"status": "ok"}200curl http://localhost:5000/api/hello→{"message": "Hello, World!"}200Level 4 — volume persistence
docker volume lsconfirmsunsdg-classifier-tool_hf-model-cachepresentdocker compose down && docker compose up, backend reached healthy state instantly with no model re-downloadNotes
.envfile Docker needs is the same one that issue introducesbash.shworkflow continues to work exactly as before for contributors who prefer not to use Docker