Spaces:
Sleeping
Sleeping
File size: 747 Bytes
2e0d130 | 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 | # Use official Python 3.9 slim image as base (smaller footprint than full Python image)
FROM python:3.9-slim
# Create non-root user as recommended by Hugging Face Spaces
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /home/user/app
# Copy requirements first (optimization for caching)
COPY --chown=user:user ./requirements.txt requirements.txt
# Install dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=user:user . .
# Expose port (7860 is the default for Hugging Face Spaces)
EXPOSE 7860
# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |