Spaces:
Running
Running
File size: 747 Bytes
61a5d17 56e1ad9 |
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 30 |
# Use Python 3.10 slim image
FROM python:3.11-slim
# Set the working directory
WORKDIR /app
# Create a non-root user (Mandatory for Hugging Face Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set working directory to the user's home
WORKDIR $HOME/app
# Copy requirements first to leverage Docker cache
COPY --chown=user:user requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY --chown=user:user . .
# Expose the port Hugging Face expects
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |