FROM python:3.9-slim WORKDIR /app # Create user with proper PATH configuration RUN useradd -m appuser && \ echo 'export PATH="$HOME/.local/bin:$PATH"' >> /home/appuser/.bashrc # System dependencies RUN apt-get update && apt-get install -y git # Set environment variables #ENV PATH="/home/appuser/.local/bin:${PATH}" \ # PYTHONPATH="/app:${PYTHONPATH}" \ # PIP_NO_WARN_SCRIPT_LOCATION=0) # Switch to non-root user USER appuser # Install Python dependencies COPY requirements.txt . RUN pip install --user --no-cache-dir -r requirements.txt # Copy application files COPY --chown=appuser:appuser . . # Verify uvicorn location RUN which uvicorn && echo $PATH # Launch command CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]