ComfyUI/Dockerfile
minkhant1996-dev f97df737b8 add config
2024-10-31 17:39:58 +07:00

48 lines
1.4 KiB
Docker

# Stage 1: Base image with common dependencies
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/*
# Clone ComfyUI repository
RUN git clone https://github.com/comfyanonymous/ComfyUI.git /comfyui
# Change working directory to ComfyUI
WORKDIR /comfyui
# Install ComfyUI dependencies
RUN pip3 install --upgrade --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 \
&& pip3 install --upgrade -r requirements.txt
# Install runpod
RUN pip3 install runpod requests
# Support for the network volume
ADD src_min/extra_model_paths.yaml ./
# Go back to the root
WORKDIR /
# Add the start and the handler
ADD src_min/start.sh src_min/rp_handler.py src_min/test_input.json ./
RUN chmod +x /start.sh
# WORKDIR /comfyui
CMD ["python3", "comfyui/main.py", "--listen", "0.0.0.0", "--port", "8188"]