File size: 1,648 Bytes
32a2025
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5b3e090
 
 
84c4d39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32a2025
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84c4d39
 
32a2025
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 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"]