File size: 759 Bytes
876b12f
 
 
 
 
 
7504fbc
 
 
2f25629
 
 
d30e475
b77d4af
 
876b12f
 
163d201
876b12f
 
 
 
 
 
 
2f25629
 
 
876b12f
 
 
 
 
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
# Use Python Slim Image
FROM python:3.10-slim

# Set working directory inside container
WORKDIR /app

# Install git (required to install from GitHub)
RUN apt-get update && apt-get install -y git

# Create a writable cache directory for Hugging Face
RUN mkdir -p /app/.cache/huggingface/hub && chmod -R 777 /app/.cache

# Upgrade pip
RUN pip install --upgrade pip

# Copy dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt

# Copy all files
COPY . .

# Set PYTHONPATH (simplified)
ENV PYTHONPATH=/app

# Set the Hugging Face transformers cache directory
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub

# Expose FastAPI's default port
EXPOSE 7860

# Start FastAPI
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]