FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04 # Environment variables ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 \ DEBIAN_FRONTEND=noninteractive # System dependencies RUN apt-get update && apt-get install -y \ python3.10 python3-pip git wget \ libgl1-mesa-glx libglib2.0-0 libsm6 libxrender1 libxext6 ffmpeg \ && rm -rf /var/lib/apt/lists/* # Create app directory WORKDIR /app # Clone ComfyUI core RUN git clone https://github.com/comfyanonymous/ComfyUI.git # Clone custom nodes RUN git clone https://github.com/cubiq/ComfyUI_IPAdapter_plus /app/ComfyUI/custom_nodes/IPAdapter_plus && \ git clone https://github.com/Kosinkadink/ComfyUI-KJNodes /app/ComfyUI/custom_nodes/KJNodes && \ git clone https://github.com/SSitu/ComfyUI_UltimateSDUpscale /app/ComfyUI/custom_nodes/UltimateSDUpscale && \ git clone https://github.com/ltdrdata/PuLID_ComfyUI /app/ComfyUI/custom_nodes/PuLID && \ git clone https://github.com/cg196/ComfyUI-UseEverywhere /app/ComfyUI/custom_nodes/UseEverywhere && \ git clone https://github.com/melMass/comfy-mtb /app/ComfyUI/custom_nodes/mtb && \ git clone https://github.com/LucianoCirino/ComfyUI_Masquerade /app/ComfyUI/custom_nodes/Masquerade && \ git clone https://github.com/Fannovel16/comfyui-save-image-with-geninfo /app/ComfyUI/custom_nodes/SaveGenInfo && \ git clone https://github.com/jamesWalker55/comfyui-various /app/ComfyUI/custom_nodes/Various # Create necessary directories RUN mkdir -p /app/ComfyUI/models/checkpoints \ /app/ComfyUI/models/controlnet \ /app/ComfyUI/models/ipadapter \ /app/ComfyUI/models/pulid \ /app/ComfyUI/models/clip_vision \ /app/ComfyUI/input \ /app/workflows # First create all necessary directories RUN mkdir -p /app/workflows # Copy workflow files COPY ./workflows/Workflow_12_11.json /app/workflows/ COPY ./workflows/Workflow_Test.json /app/workflows/ # Copy default input images COPY ./ComfyUI/input/*.jpg /app/ComfyUI/input/ # Install Python dependencies COPY ./requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt # Copy model download script COPY ./download_models.py . RUN python3 download_models.py || true # Copy application code COPY ./app.py . COPY ./start.sh . # Make scripts executable RUN chmod +x /app/start.sh # Expose ports for Gradio and ComfyUI EXPOSE 7860 8188 # Set the entrypoint ENTRYPOINT ["/app/start.sh"]