# Use official Python base image FROM python:3.9 # Create a non-root user RUN useradd -m -u 1000 user USER user # Set up the path ENV PATH="/home/user/.local/bin:$PATH" # Set the working directory WORKDIR /app # Install Python dependencies COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the rest of the app COPY --chown=user . /app # Start the FastAPI app using Uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]