FROM python:3.10-slim WORKDIR /app # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy source code COPY . . # Create a non-root user for security RUN adduser --system --uid 1001 backenduser \ && chown -R backenduser /app # Switch to the non-root user USER backenduser # Expose port EXPOSE 8000 # Start FastAPI server CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]