Spaces:
Paused
Paused
| # Use an official Ubuntu as a parent image | |
| FROM ubuntu:latest | |
| # Set environment variables to non-interactive (to avoid prompts) | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Switch to root user | |
| USER root | |
| # Update package list, install necessary packages, and clean up | |
| RUN apt-get update && \ | |
| apt-get install -y \ | |
| build-essential \ | |
| git \ | |
| curl \ | |
| wget \ | |
| vim \ | |
| nano \ | |
| unzip \ | |
| zip \ | |
| python3 \ | |
| python3-pip \ | |
| python3-venv \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create working directory | |
| WORKDIR /ComfyUI | |
| # Copy the application files | |
| COPY . /ComfyUI | |
| # Create a Python virtual environment | |
| RUN python3 -m venv /venv | |
| # Upgrade pip | |
| RUN /venv/bin/pip install --upgrade pip | |
| # Install Python dependencies directly | |
| RUN /venv/bin/pip install torch \ | |
| torchsde \ | |
| torchvision \ | |
| torchaudio \ | |
| einops \ | |
| transformers>=4.28.1 \ | |
| tokenizers>=0.13.3 \ | |
| sentencepiece \ | |
| safetensors>=0.4.2 \ | |
| aiohttp \ | |
| pyyaml \ | |
| Pillow \ | |
| scipy \ | |
| tqdm \ | |
| psutil \ | |
| kornia>=0.7.1 \ | |
| spandrel \ | |
| soundfile | |
| # Set environment variable for the Python virtual environment | |
| ENV PATH="/venv/bin:$PATH" | |
| # Expose the necessary port | |
| EXPOSE 7860 | |
| # Define the startup script | |
| RUN echo '#!/bin/bash\n\ | |
| \n\ | |
| # Activate the virtual environment\n\ | |
| source /venv/bin/activate\n\ | |
| \n\ | |
| # Set environment variables to use CPU only\n\ | |
| export CUDA_VISIBLE_DEVICES=""\n\ | |
| \n\ | |
| # Start ComfyUI with --cpu option\n\ | |
| python3 main.py --listen 0.0.0.0 --port 7860 --cpu\n' > /start.sh | |
| # Set permissions for the startup script | |
| RUN chmod 755 /start.sh | |
| # Set the entry point to the startup script | |
| ENTRYPOINT ["/start.sh"] | |