Skip to content

add Docker support and production-ready deployment setup#5

Open
maheshshinde9100 wants to merge 1 commit into
ayush-kumar-24:mainfrom
maheshshinde9100:docker-support
Open

add Docker support and production-ready deployment setup#5
maheshshinde9100 wants to merge 1 commit into
ayush-kumar-24:mainfrom
maheshshinde9100:docker-support

Conversation

@maheshshinde9100

Copy link
Copy Markdown

Description

This PR introduces complete Docker support for the NyayaSetu-AI application to simplify local development, improve onboarding, and enable production-ready deployment for both the FastAPI backend and React frontend.

The update includes Dockerfiles for both services, Docker Compose orchestration, optimized Docker build configurations, environment-based frontend API configuration, and updated project documentation.

Closes #2
Closes #4


Proposed Changes

Backend

  • Added Dockerfile.backend using python:3.10-slim
  • Installed required system dependencies for FAISS and backend services
  • Configured Uvicorn startup with environment-based port support

Frontend

  • Added multi-stage frontend/Dockerfile
  • Built React + Vite application in a Node environment
  • Configured Nginx for serving the production build

Docker Orchestration

  • Added docker-compose.yml for managing frontend and backend services together
  • Exposed:
    • Backend → 8000
    • Frontend → 3000
  • Added persistent volume mappings for .env, FAISS files, and SQLite database

Build Optimization

  • Added .dockerignore files in both root and frontend directories
  • Excluded unnecessary files such as:
    • node_modules
    • __pycache__
    • .git
    • local environment folders

Configuration Improvements

  • Updated frontend/src/services/api.js
  • Added support for configurable backend URLs using:
    VITE_API_URL

Documentation

  • Updated README.md with:
    • Docker setup instructions
    • Simplified startup steps
    • Corrected repository/project structure

Benefits

  • Consistent Development Environment
    Ensures all contributors use the same setup across systems.

  • Easy Onboarding
    Developers can start the full stack using:

    docker-compose up --build
  • Production-Ready Deployment
    Provides containerized infrastructure suitable for deployment platforms and cloud hosting.

  • Optimized Docker Builds
    Reduced image size and faster build times using .dockerignore and multi-stage builds.


How to Test

  1. Install Docker and Docker Compose
  2. Create a root .env file:
    GROQ_API_KEY=your_api_key
  3. Run:
    docker-compose up --build
  4. Verify services:

Files Added / Updated

  • .dockerignore
  • Dockerfile.backend
  • docker-compose.yml
  • frontend/.dockerignore
  • frontend/Dockerfile
  • frontend/src/services/api.js
  • README.md

- add Dockerfile for FastAPI backend with Python 3.10 slim
- add multi-stage Dockerfile for React/Vite frontend with Nginx
- add docker-compose configuration for full-stack orchestration
- add .dockerignore files to optimize Docker build context
- update frontend API service to use VITE_API_URL env variable
- update README with Docker setup instructions and corrected project structure
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 Docker support and production-ready backend deployment setup Add Docker Support for Frontend and Backend Setup

1 participant