New-bg / Dockerfile
Wiuhh's picture
Upload 5 files
be1de07 verified
raw
history blame contribute delete
766 Bytes
# Use Python 3.11 base image
FROM python:3.11-slim
# Create non-root user (required for Hugging Face Spaces)
RUN useradd -m -u 1000 user
USER user
# Set environment variables
ENV PATH="/home/user/.local/bin:$PATH"
ENV PYTHONPATH="/app"
# Set working directory
WORKDIR /app
# Copy requirements and install dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy application files
COPY --chown=user . /app
# Create necessary directories
RUN mkdir -p uploads outputs
# Expose port 7860 (required for Hugging Face Spaces)
EXPOSE 7860
# Use Gunicorn to serve the application
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--threads", "2", "--timeout", "120", "app:app"]