BrianChuan
fix
d1bd264
Raw
History Blame Contribute Delete
900 Bytes
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM python:3.9
# Create a non-root user with UID 1000 to comply with Hugging Face Space security guidelines
RUN useradd -m -u 1000 user
# Set up environment variables for the new user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to user's home app directory
WORKDIR $HOME/app
# Switch to the non-root user
USER user
# Copy requirements and install dependencies
COPY --chown=user requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy all project files into the container
COPY --chown=user . .
# Expose port 7860 (Hugging Face Spaces default port)
EXPOSE 7860
# Run the FastAPI application using uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]