Spaces:
Sleeping
Sleeping
File size: 495 Bytes
fe49021 |
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 |
FROM python:3.9-slim
# Create a non-root user
RUN useradd -m -u 1000 user
WORKDIR /app
# Copy requirements first to leverage cache
COPY requirements.txt /app/requirements.txt
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY --chown=user:user . /app
# Switch to the non-root user
USER user
# Expose the port
EXPOSE 7860
# Run with Gunicorn for production-grade performance
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
|