File size: 608 Bytes
2b33fc2
 
7c05ef7
2b33fc2
 
 
 
 
 
7c05ef7
2b33fc2
 
 
7c05ef7
2b33fc2
f157e17
7c05ef7
 
f157e17
7c05ef7
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM python:3.9

# Create a non-root user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

WORKDIR /app

# Copy and install requirements first for caching
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy the rest of the application
COPY --chown=user . /app

# Set the Flask app entry point for the 'flask run' command
ENV FLASK_APP=flask_app.py

# Run the Flask app on port 7860 (common for HF Spaces) and bind to all interfaces
CMD ["python", "-m", "flask", "run", "--host", "0.0.0.0", "--port", "7860"]