EALPR_FLASK / Dockerfile
Pant0x's picture
Final synced deploy v2 - Fix session and timeouts
cd01269
Raw
History Blame Contribute Delete
904 Bytes
# Use Python 3.11 slim image
FROM python:3.11-slim
# Install system dependencies
# libglib2.0-0 is often needed for some image processing libraries
RUN apt-get update && apt-get install -y \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user (UID 1000 is required by Hugging Face)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copy and install dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Copy the application code
COPY --chown=user . .
# Hugging Face Spaces expects the app to listen on port 7860
EXPOSE 7860
# Run the application with gunicorn
# Using 1 worker and 8 threads for a balance of performance and resource usage
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "8", "--timeout", "0", "app:app"]