# Use Nvidia CUDA base image FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 as base # Prevents prompts from packages asking for user input during installation ENV DEBIAN_FRONTEND=noninteractive # Prefer binary wheels over source distributions for faster pip installations ENV PIP_PREFER_BINARY=1 # Ensures output from python is printed immediately to the terminal without buffering ENV PYTHONUNBUFFERED=1 # Install Python, git and other necessary tools RUN apt-get update && apt-get install -y \ python3.10 \ python3-pip \ git \ wget # Clean up to reduce image size RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* # Set the working directory in the container WORKDIR /app # Copy the current directory contents into the container COPY . /app # Install ffmpeg via apt for any potential multimedia processing RUN apt-get update -qq && apt-get install -y ffmpeg # Navigate to the ComfyUI directory, install its requirements WORKDIR /app/ComfyUI RUN pip3 install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 \ && pip3 install --no-cache-dir xformers==0.0.21 \ && pip3 install -r requirements.txt # Install FizzNodes requirements WORKDIR /app/ComfyUI/custom_nodes/ComfyUI_FizzNodes RUN pip install -r requirements.txt # Install ComfyUI-Advanced-ControlNet requirements WORKDIR /app/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet RUN pip install -r requirements.txt # Install comfyui_controlnet_aux requirements WORKDIR /app/ComfyUI/custom_nodes/comfyui_controlnet_aux RUN pip install -r requirements.txt # Install ComfyUI-VideoHelperSuite requirements WORKDIR /app/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite RUN pip install -r requirements.txt # Install facerestore_cf requirements WORKDIR /app/ComfyUI/custom_nodes/facerestore_cf RUN pip install -r requirements.txt # Install DTAIImageToTextNode requirements WORKDIR /app/ComfyUI/custom_nodes/DTAIImageToTextNode RUN pip install -r requirements.txt # Navigate back to the /app directory to run server.py WORKDIR /app RUN pip3 install -r requirements.txt # Make the start.sh script executable RUN chmod +x ./start.sh # Start the container with start.sh script from the current working directory (/app) CMD ["./start.sh"]