Skip to content

Add Dockerfile and docker-compose for one-command local setup#48

Open
Gunjan10-droid wants to merge 3 commits into
umang24-cyber:mainfrom
Gunjan10-droid:feature/docker-compose-setup
Open

Add Dockerfile and docker-compose for one-command local setup#48
Gunjan10-droid wants to merge 3 commits into
umang24-cyber:mainfrom
Gunjan10-droid:feature/docker-compose-setup

Conversation

@Gunjan10-droid

Copy link
Copy Markdown

Related Issue

Closes #44

Summary

This PR adds Docker support for easier local development.

Changes

  • Added Dockerfile for backend_python
  • Added Dockerfile for ai/cv
  • Added Dockerfile for ai/nlp
  • Added .dockerignore files
  • Added root-level docker-compose.yml
  • Updated README with Docker setup instructions

Notes

  • Docker images were verified to build successfully for backend, CV, and NLP services.
  • AI model files are excluded from images to keep image sizes smaller.
  • ai/lstm was not containerized because it currently does not expose a standalone service.

@Gunjan10-droid

Copy link
Copy Markdown
Author

@umang24-cyber could you merge the pr for ssoc26?

@Ishwarpatra Ishwarpatra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Gunjan10-droid left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

Add Dockerfile + docker-compose for one-command local setup (backend + AI services)

2 participants