File size: 626 Bytes
1423dd9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 an official Python image
FROM python:3.12-slim

# Set working directory
WORKDIR /app

# Create a cache directory with proper permissions
RUN mkdir -p /data/.cache/huggingface && chmod -R 777 /data

# Set environment variables for Hugging Face cache
ENV HF_HOME=/data/.cache/huggingface
ENV TRANSFORMERS_CACHE=/data/.cache/huggingface/transformers
ENV HF_DATASETS_CACHE=/data/.cache/huggingface/datasets

# Copy code
COPY . .

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

# Expose the port
EXPOSE 7860

# Run the FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]