| # Start from a slim Python 3.10 base image | |
| FROM python:3.10-slim | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Copy the requirements file first to leverage Docker cache | |
| COPY requirements.txt . | |
| # Install the Python dependencies | |
| # --no-cache-dir saves space | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application files | |
| # This includes app.py AND your model folder (bert-indian-legal-intent) | |
| COPY . . | |
| # Hugging Face Spaces *requires* the app to run on port 7860 | |
| EXPOSE 7860 | |
| # Command to run the FastAPI server using uvicorn | |
| # 0.0.0.0 makes it accessible outside the container | |
| # app:app refers to the 'app' object in the 'app.py' file | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |