File size: 683 Bytes
3d53520
 
 
babaae6
 
 
3d53520
babaae6
 
 
 
3d53520
babaae6
 
 
 
 
3d53520
 
 
babaae6
3d53520
babaae6
8328a58
3d53520
babaae6
 
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 an official lightweight Python image
FROM python:3.11-slim

# Create a non-root user (Required by Hugging Face Spaces)
RUN useradd -m -u 1000 user

USER user


# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONUNBUFFERED=1

# Set the working directory
WORKDIR $HOME/app

# Copy requirements and install them
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of your application code
COPY --chown=user . .

# Hugging Face routes traffic to port 7860
EXPOSE 7860

# Run the application using Gunicorn 
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]