fastapi / Dockerfile
bigbossmonster's picture
Create Dockerfile
09af3ee verified
raw
history blame contribute delete
623 Bytes
FROM python:3.10
# Set the working directory to /app
WORKDIR /app
# Copy the requirements file from your local machine to the container
COPY requirements.txt .
# Install the dependencies listed in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of your application code
COPY . .
# Create a non-root user (Security requirement for some HF Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Command to run the application on port 7860 (Hugging Face's default port)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]