a1 / Dockerfile
at41rv's picture
Update Dockerfile
6ba1d2f verified
raw
history blame contribute delete
690 Bytes
# Use a Python base image
FROM python:3.9-slim-buster
# Create a non-root user for security best practices
RUN useradd -m -u 1000 user
USER user
# Set the working directory inside the container
WORKDIR /app
# Copy the requirements file and install dependencies
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Add the user's local bin directory to the PATH
ENV PATH="/home/user/.local/bin:$PATH"
# Copy your application code
COPY --chown=user:user . .
# Expose the port Hugging Face Spaces expects (7860)
EXPOSE 7860
# Command to run your FastAPI application with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]