Spaces:
Sleeping
Sleeping
File size: 635 Bytes
7f51074 |
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 |
# Use a Python 3.9 base image
FROM python:3.9-slim
# Set working directory
WORKDIR /code
# Copy requirements file
COPY ./requirements.txt /code/requirements.txt
# Install dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Create a non-root user for security
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
# Set app directory
WORKDIR $HOME/app
# Copy all project files
COPY --chown=user . $HOME/app
# Expose port 7860 (Hugging Face default)
EXPOSE 7860
# Run the FastAPI app with uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |