ComfyUI-CPU / Dockerfile.work
R1000's picture
Rename Dockerfile to Dockerfile.work
89af78d verified
Raw History Blame Contribute Delete
2.76 kB
FROM python:3.10-slim
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PORT=7860
ENV OMP_NUM_THREADS=2
ENV MKL_NUM_THREADS=2
ENV OPENBLAS_NUM_THREADS=2
ENV NUMEXPR_NUM_THREADS=2
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
git-lfs \
curl \
wget \
ffmpeg \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgomp1 \
ca-certificates \
build-essential \
&& rm -rf /var/lib/apt/lists/* \
&& git lfs install
RUN useradd --create-home --shell /bin/bash --uid 1000 user
WORKDIR /app
RUN pip install --no-cache-dir \
--upgrade pip setuptools wheel
# CPU-only PyTorch
RUN pip install --no-cache-dir \
"torch==2.7.1" \
"torchvision==0.22.1" \
"torchaudio==2.7.1" \
--index-url https://download.pytorch.org/whl/cpu
# ComfyUI
RUN git clone --depth 1 \
https://github.com/comfyanonymous/ComfyUI.git \
/app/ComfyUI
WORKDIR /app/ComfyUI
# ComfyUI requirements
RUN pip install --no-cache-dir -r requirements.txt
# Extra packages for your workflow
RUN pip install --no-cache-dir \
huggingface_hub \
psutil \
websocket-client \
opencv-python-headless \
einops \
transformers \
safetensors \
color-matcher \
scikit-image \
numba \
dynamicprompts \
diffusers
# Model directories
RUN mkdir -p \
/app/ComfyUI/models/checkpoints \
/app/ComfyUI/models/diffusion_models \
/app/ComfyUI/models/text_encoders \
/app/ComfyUI/models/vae \
/app/ComfyUI/models/loras \
/app/ComfyUI/models/upscale_models \
/app/ComfyUI/models/clip \
/app/ComfyUI/input \
/app/ComfyUI/output \
/app/ComfyUI/temp
# Fix permissions
RUN chown -R user:user /app
USER user
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH
ENV PYTHONPATH=/app/ComfyUI
WORKDIR /app/ComfyUI
# Diagnostic check
RUN python - <<'PY'
import torch
import comfy_kitchen
print("=" * 60)
print("PyTorch:", torch.__version__)
print("CUDA available:", torch.cuda.is_available())
print("CUDA version:", torch.version.cuda)
print("comfy_kitchen:", comfy_kitchen.__file__)
print("int8_attention_is_available:",
hasattr(comfy_kitchen, "int8_attention_is_available"))
print("=" * 60)
assert torch.__version__.startswith("2.7.1")
assert not torch.cuda.is_available()
assert hasattr(comfy_kitchen, "int8_attention_is_available")
PY
EXPOSE 7860
HEALTHCHECK \
--interval=30s \
--timeout=10s \
--start-period=180s \
--retries=5 \
CMD curl -f http://127.0.0.1:7860/system_stats || exit 1
CMD ["python", "-u", "main.py", \
"--cpu", \
"--listen", "0.0.0.0", \
"--port", "7860", \
"--output-directory", "/app/ComfyUI/output"]