File size: 1,127 Bytes
b2b6341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4e70eb5
b2b6341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5e719b7
 
b2b6341
5e719b7
 
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
33
34
35
36
37
38
39
# Use an official Python runtime as a parent image
FROM python:3.11-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app

# Set work directory
WORKDIR /app

# Install system dependencies required for FAISS, Pillow, and other ML libraries
RUN apt-get update && apt-get install -y \
    build-essential \
    libgomp1 \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements file first to leverage Docker cache
COPY requirements.txt .

# Install Python dependencies
# We use --no-cache-dir to keep the image size small
RUN pip install --no-cache-dir -r requirements.txt

# Copy the entire backend directory into the container
# Since docker builds from root context, we map backend/ -> /app/backend
COPY backend/ ./backend/

# Create necessary data directories (so they exist for the app)
RUN mkdir -p /app/data/uploaded_files /app/data/faiss_index /app/models

# Expose the port Hugging Face expects (7860)
EXPOSE 7860

# Command to run the application on port 7860
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]