FROM python:3.11 # Cài phụ thuộc hệ thống RUN apt-get update && apt-get install -y \ git ffmpeg libgl1 libglib2.0-0 curl wget unzip \ && rm -rf /var/lib/apt/lists/* # Làm việc trong workspace WORKDIR /workspace RUN git clone https://github.com/comfyanonymous/ComfyUI.git RUN sed -i 's/torch.device(torch.cuda.current_device())/torch.device("cpu")/' /workspace/ComfyUI/comfy/model_management.py # Cài Python package WORKDIR /workspace/ComfyUI RUN pip install --upgrade pip && pip install -r requirements.txt # Cài torch bản CPU RUN pip uninstall -y torch torchvision torchaudio RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu RUN useradd -m -u 1000 user RUN chown -R user:1000 /workspace/ComfyUI USER user EXPOSE 8188 CMD ["python", "main.py", "--listen", "0.0.0.0"]