FROM python:3.10-slim # Hugging Face Spaces requires running as a non-root user RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set up the working directory and Hugging Face cache dir WORKDIR /app ENV HF_HOME="/app/.cache/huggingface" # Install Python requirements COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of your app code COPY --chown=user . . # Expose Hugging Face's default port EXPOSE 7860 # Run the app using the foundation InstructPix2Pix model CMD ["python", "-u", "-m", "server.app", "--provider", "foundation", "--foundation-backend", "instruct-pix2pix", "--host", "0.0.0.0", "--port", "7860"]