Spaces:
Sleeping
Sleeping
| # Use an official Python runtime as a parent image | |
| FROM python:3.11-slim | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Install system dependencies required for building some Python packages | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy the requirements files into the container | |
| COPY requirements.txt similarity_requirements.txt ./ | |
| # --- Create and populate the main virtual environment --- | |
| RUN python3 -m venv env | |
| RUN ./env/bin/pip install --no-cache-dir -r requirements.txt | |
| # --- Create and populate the similarity worker virtual environment --- | |
| RUN python3 -m venv similarity_env | |
| RUN ./similarity_env/bin/pip install --no-cache-dir -r similarity_requirements.txt | |
| # Copy the rest of the backend application files into the container | |
| COPY . . | |
| # Expose the port the app runs on (standard for Hugging Face Spaces) | |
| EXPOSE 7860 | |
| # Define the command to run the application | |
| # Use the Python from the main virtual environment to run uvicorn | |
| CMD ["./env/bin/python3", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |