File size: 617 Bytes
fdd0d4b
 
 
 
 
 
 
 
 
 
 
 
 
 
84120af
fdd0d4b
 
 
 
 
 
 
 
fd21613
585056f
85059d4
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
# Use Python slim image
FROM python:3.10-slim

# Set environment variable to avoid /.cache permission error
ENV TRANSFORMERS_CACHE=/tmp/hf_cache

# Set working directory
WORKDIR /code

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

# Pre-download Hugging Face model (optional but recommended)
RUN python -c "from transformers import pipeline; pipeline('summarization', model='philschmid/bart-large-cnn-samsum')"

# Copy app code
COPY ./app ./app

# Expose port
EXPOSE 7860

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