# Use an official Python runtime as a parent image FROM python:3.11-slim # Set environment variables ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PATH="/home/user/.local/bin:$PATH" # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ git \ && rm -rf /var/lib/apt/lists/* # Create a non-root user RUN useradd -m -u 1000 user USER user WORKDIR /home/user/app # Install uv RUN curl -LsSf https://astral.sh/uv/install.sh | sh # Copy the application code COPY --chown=user . . # Install dependencies using uv # We use --system because we want to install into the container's python environment RUN uv pip install --system . # Expose the port Hugging Face expects EXPOSE 7860 # Command to run the application CMD ["python", "-m", "app.main"]