FROM python:3.9 # Set up non-root user RUN useradd -m -u 1000 user USER user # Set working directory WORKDIR /home/user/app # Install system dependencies (if any) # RUN apt-get update && apt-get install -y ... # Install Python dependencies COPY ./requirements.txt /home/user/app/requirements.txt RUN pip install --no-cache-dir --upgrade -r /home/user/app/requirements.txt # Copy only necessary files COPY --chown=user . /home/user/app # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Command to run the application CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]