File size: 965 Bytes
c2f2dbc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2b7a709
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
# Use the official Python 3.10 slim image
FROM python:3.10-slim

# Set the working directory in the container
WORKDIR /app

# Set environment variables
# Prevents Python from writing .pyc files and ensures logs are flushed to terminal
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Install system dependencies if needed (none required for this specific script)
# RUN apt-get update && apt-get install -y --no-install-recommends gcc

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

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
COPY . .

# Hugging Face Spaces runs on port 7860 by default
# We expose this port for documentation
EXPOSE 7860

# Start the FastAPI application using uvicorn
# We use main:app (assuming your file is named main.py and the FastAPI instance is 'app')
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]