FROM python:3.13 # Create a non-root user specifically for Hugging Face Spaces (UID 1000) RUN useradd -m -u 1000 user WORKDIR /code COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Switch to the non-root user USER user # Copy the rest of the app with correct ownership COPY --chown=user . /code CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]