# Use an official Python runtime as a parent image FROM python:3.11-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV PORT 7860 # Set the working directory in the container WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ && rm -rf /var/lib/apt/lists/* # Copy the requirements file into the container COPY requirements.txt . # Install any needed packages specified in requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application code into the container COPY . . # Create a non-root user and switch to it for better security on HF RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Make sure the static directory exists RUN mkdir -p /app/static # Expose the port the app runs on EXPOSE 7860 # Run the application CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "7860"]