FROM python:3.10-slim # Install basic utilities RUN apt-get update && apt-get install -y \ curl \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Create directory for files RUN mkdir -p /app/files # Create user to avoid running as root (similar to your main app) RUN useradd -m -u 1000 user # Change ownership of directories RUN chown -R user:user /app USER user ENV PATH="/home/user/.local/bin:$PATH" ENV PYTHONUNBUFFERED=1 # Install dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY --chown=user . . # Run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]