FROM python:3.10 # Set up a new user named "user" with user ID 1000 RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set working directory WORKDIR /app # Copy requirements first to leverage Docker cache COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the rest of the application COPY --chown=user . /app # Create the models directory explicitly to ensure it exists and is writable # (Your python script needs this to download the models at runtime) RUN mkdir -p /app/models # Start the application # CHANGED: "app:app" -> "main:app" because your file is named main.py CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]