File size: 634 Bytes
9f25ef7
 
8dd061f
9f25ef7
 
 
f3118ca
 
 
9f25ef7
 
 
 
 
 
8dd061f
9f25ef7
8dd061f
 
9f25ef7
f3118ca
8dd061f
9f25ef7
 
8dd061f
9f25ef7
 
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 the official Python slim image for a smaller footprint
FROM python:3.11-slim

# Set working directory
WORKDIR /app

ARG API_TOKEN=$API_TOKEN


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

# Copy the Flask app code
COPY . .

# Create a non-root user for security (Hugging Face requirement)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
ENV API_TOKEN=$API_TOKEN

# Expose port 7860 (required by Hugging Face)
EXPOSE 7860

# Run the Flask app with Gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]