FROM python:3.10-slim ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 # Install system dependencies RUN apt-get update && apt-get install -y \ git \ wget \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Clone ComfyUI RUN git clone https://github.com/comfyanonymous/ComfyUI.git . # Install CPU-only PyTorch stack (torchaudio must come from CPU index or it links libcudart) RUN pip install --no-cache-dir \ torch torchvision torchaudio \ --index-url https://download.pytorch.org/whl/cpu && \ pip install --no-cache-dir -r requirements.txt # Download a small fast model (SD 1.5 pruned EMA-only ~2GB) RUN mkdir -p models/checkpoints models/vae models/controlnet && \ wget -q --show-progress \ https://huggingface.co/genai-archive/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.fp16.safetensors \ -O models/checkpoints/v1-5-pruned-emaonly.fp16.safetensors # Expose the port HF Spaces expects EXPOSE 7860 # Run ComfyUI in CPU mode bound to all interfaces on port 7860 CMD ["python", "main.py", "--listen", "0.0.0.0", "--port", "7860", "--cpu"]