File size: 661 Bytes
b01f773
 
 
4eb9181
 
 
b01f773
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4eb9181
 
b01f773
 
 
 
 
 
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
# Use official Python slim image for a leaner container
FROM python:3.10-slim

# Set environment variable for Hugging Face cache
ENV HF_HOME=/app/cache

# Set working directory
WORKDIR /app

# Copy the Flask app code
COPY app.py .

# Install system dependencies
RUN apt-get update && apt-get install -y \
    gcc \
    && rm -rf /var/lib/apt/lists/*

# Install Python packages
RUN pip install --no-cache-dir \
    flask \
    transformers \
    torch \
    && pip cache purge

# Create and set permissions for Hugging Face cache
RUN mkdir -p /app/cache && chmod -R 777 /app

# Expose port 5000 for Flask
EXPOSE 7860

# Run the Flask app
CMD ["python", "app.py"]