Add Dockerfile and docker-compose for one-command local setup#48
Add Dockerfile and docker-compose for one-command local setup#48Gunjan10-droid wants to merge 3 commits into
Conversation
|
@umang24-cyber could you merge the pr for ssoc26? |
Ishwarpatra
left a comment
There was a problem hiding this comment.
Fixing this PR
issues:
The backend_python service is designed to load and run all AI models (LSTM, CV, NLP, Anomaly) in-process via direct Python imports of ai/*/inference.py. There are zero HTTP calls or client configurations inside backend_python to communicate with external CV or NLP services over ports.
the AI model weights are excluded from the backend_python container image, the load_cv_pipeline() and load_nlp_pipeline() routines will fail to find the .pt and .pth weight files at boot. As designed, the backend will silently catch these failures and switch to mock fallback mode.
The separate cv and nlp containers will spin up, load the PyTorch models into memory (consuming heavy CPU and RAM), and listen on their respective ports. However, they will receive zero incoming traffic because the backend never routes requests to them. The end user will see mock data on the frontend while active containers sit completely idle.
To accept this PR, the contributor must choose one of the following two paths:
True Microservice Architecture
Refactor the service layer in the backend to query the containers when run under Docker:
Modify backend_python/services/cv_service.py and nlp_service.py to check for environment variables (e.g., CV_SERVICE_URL, NLP_SERVICE_URL).
If these variables are set, perform HTTP POST requests using httpx to the external containers instead of running local imports.
Removed cv and nlp services from docker-compose.
Updated README to clarify Docker command and service details.
Gunjan10-droid
left a comment
There was a problem hiding this comment.
Thanks for the review. I updated the Docker Compose configuration to match the current architecture. The backend now remains the only runtime service responsible for loading the AI modules in-process, while the separate Dockerfiles for the CV and NLP components are retained for future service separation. The README has also been updated to reflect this behavior.
Related Issue
Closes #44
Summary
This PR adds Docker support for easier local development.
Changes
backend_pythonai/cvai/nlp.dockerignorefilesdocker-compose.ymlNotes
ai/lstmwas not containerized because it currently does not expose a standalone service.