FROM python:3.11.11-bookworm # Set working directory WORKDIR /app # Copy only requirements first to leverage Docker layer caching COPY requirements.txt /app/ # Install dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application code COPY . /app # Switch to a non-root user (optional) # RUN useradd -m appuser && chown -R appuser /app # USER appuser # Default command (optional, replace "app.py" with your app's entry point) CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]