File size: 1,110 Bytes
f3918ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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"]