FROM python:3.10-slim # Create a user RUN useradd -m -u 1000 user USER user # Set working directory WORKDIR /app # Copy requirements and install globally COPY requirements.txt . RUN pip install --no-cache-dir --upgrade --break-system-packages -r requirements.txt # Copy all files COPY . . # Set environment variable for FastAPI port ENV PORT=7860 # Ensure uvicorn is in PATH ENV PATH="/home/user/.local/bin:$PATH" # Run the FastAPI app CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]