Spaces:
Runtime error
Runtime error
File size: 793 Bytes
a4659fb | 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 28 29 | # Use a lightweight and stable Python 3.11 base image
FROM python:3.11-slim-buster AS base
# Set environment variables for production
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PATH="/home/user/.local/bin:$PATH"
# Add a non-root user for security
RUN useradd -m -u 1000 user
# Switch to non-root user
USER user
# Set working directory
WORKDIR /app
# Install dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --upgrade -r requirements.txt
# Copy application files
COPY --chown=user . /app
# Expose the application port
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "4", "--log-level", "info"] |