File size: 796 Bytes
a7323d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use the official Python 3.13 slim image for a lightweight base
FROM python:3.13.2

# Set the working directory to /app
WORKDIR /app

# Copy only requirements.txt first to leverage Docker caching
COPY requirements.txt .

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

# Copy the rest of the application files
COPY . .

# Create cache directories and set permissions
RUN mkdir -p /tmp/huggingface_cache && chmod -R 777 /tmp/huggingface_cache && rm -rf /tmp/huggingface_cache/*

# Set environment variable for Transformers cache
ENV HF_HOME=/tmp/huggingface_cache

# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860

# Start the FastAPI app with Uvicorn on port 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]