FROM python:3.13.3-slim # Set up a new user named "user" with user ID 1000 RUN useradd -m -u 1000 user # Add local bin to PATH to ensure uvicorn is accessible ENV PATH="/home/user/.local/bin:$PATH" # Switch to the "user" user USER user # Set the working directory WORKDIR /app COPY --chown=user ./requirements.txt /app/requirements.txt # Ensure pip installs packages to the global environment RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt COPY --chown=user . /app EXPOSE 8000 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]