# Use the official Python 3.9 image FROM python:3.14.0 # Set the working directory to /code WORKDIR /code # Copy the requirements file first to leverage Docker cache COPY ./requirements.txt /code/requirements.txt # Install the dependencies RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Copy the rest of the application code COPY . /code # Create a non-root user to run the app (Hugging Face requirement for security) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set the CMD to your handler CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]