Update Dockerfile
Browse files1 unmodified line234567891011121314151617181920212223242526272829303132331 unmodified lineFROM ubuntu:24.04ENV DEBIAN_FRONTEND=noninteractiveRUN apt-get update && apt-get install -y \python3 python3-venv python3-pip git wget \&& rm -rf /var/lib/apt/lists/*WORKDIR /workspaceRUN git clone https://github.com/comfyanonymous/ComfyUI.gitWORKDIR /workspace/ComfyUIRUN python3 -m venv .venv \&& . .venv/bin/activate \&& pip install --upgrade pip \&& pip install huggingface_hub xformers!=0.0.18 \&& pip install -r requirements.txt# Create the user directory with permissive rightsRUN mkdir -p /workspace/ComfyUI/user && chmod -R 777 /workspace/ComfyUI/user# Copy download scriptCOPY download_flux.py /workspace/ComfyUI/download_flux.py# Use secret to download model files via huggingface_hubRUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \. .venv/bin/activate && \python download_flux.pyEXPOSE 7860# Use split cross attention flag and listen on all interfaces, enforce CPU modeCMD ["/bin/bash", "-c", "source .venv/bin/activate && python3 main.py --listen 0.0.0.0 --port 7860 --cpu --use-split-cross-attention"]1 unmodified line2345678910111213141516171819202122232425262728293031323334353637383940414243441 unmodified lineFROM ubuntu:24.04ENV DEBIAN_FRONTEND=noninteractive# Install system depsRUN apt-get update && apt-get install -y \python3 python3-venv python3-pip git wget \&& rm -rf /var/lib/apt/lists/*# Create a non-root userRUN useradd -m -s /bin/bash comfyWORKDIR /workspaceRUN git clone https://github.com/comfyanonymous/ComfyUI.gitWORKDIR /workspace/ComfyUI# Create Python venv & install dependencies as rootRUN python3 -m venv .venv \&& . .venv/bin/activate \&& pip install --upgrade pip \&& pip install huggingface_hub xformers!=0.0.18 \&& pip install -r requirements.txt# Pre-create writable foldersRUN mkdir -p /workspace/ComfyUI/user /workspace/ComfyUI/temp \&& chown -R comfy:comfy /workspace/ComfyUI/user /workspace/ComfyUI/temp# Copy download scriptCOPY download_flux.py /workspace/ComfyUI/download_flux.py# Run model download with secret token as rootRUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \. .venv/bin/activate && \python download_flux.py# Make sure entire repo is owned by comfy (safe for venv)RUN chown -R comfy:comfy /workspace/ComfyUI# Switch to comfy userUSER comfyEXPOSE 7860CMD ["/bin/bash", "-c", "source .venv/bin/activate && python3 main.py --listen 0.0.0.0 --port 7860 --cpu --use-split-cross-attention"]
Dockerfile+15-4