Man-isH-07 commited on
Commit
1469317
·
1 Parent(s): 98cb2c7
Files changed (2) hide show
  1. Dockerfile +48 -7
  2. app.py +25 -1
Dockerfile CHANGED
@@ -9,15 +9,56 @@ WORKDIR /home/user/app
9
  # Copy all files to the container
10
  COPY . .
11
 
12
- # Clone custom node repositories
13
- RUN git clone https://github.com/Fannovel16/ComfyUI-YoloWorld-EfficientSAM.git custom_nodes/ComfyUI-YoloWorld-EfficientSAM
14
- RUN git clone https://github.com/Acly/comfyui-inpaint-nodes.git custom_nodes/comfyui-inpaint-nodes
15
- RUN git clone https://github.com/rgthree/rgthree-comfy.git custom_nodes/rgthree-comfy
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  # Install dependencies for custom nodes (if they have requirements.txt)
18
- RUN if [ -f "custom_nodes/ComfyUI-YoloWorld-EfficientSAM/requirements.txt" ]; then pip install -r custom_nodes/ComfyUI-YoloWorld-EfficientSAM/requirements.txt; fi
19
- RUN if [ -f "custom_nodes/comfyui-inpaint-nodes/requirements.txt" ]; then pip install -r custom_nodes/comfyui-inpaint-nodes/requirements.txt; fi
20
- RUN if [ -f "custom_nodes/rgthree-comfy/requirements.txt" ]; then pip install -r custom_nodes/rgthree-comfy/requirements.txt; fi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  # Install dependencies
23
  RUN pip install --no-cache-dir --upgrade pip
 
9
  # Copy all files to the container
10
  COPY . .
11
 
12
+ # Clone custom node repositories with error handling and debug output
13
+ RUN echo "Cloning ComfyUI-YoloWorld-EfficientSAM..." && \
14
+ git clone https://github.com/Fannovel16/ComfyUI-YoloWorld-EfficientSAM.git custom_nodes/ComfyUI-YoloWorld-EfficientSAM || \
15
+ echo "Failed to clone ComfyUI-YoloWorld-EfficientSAM"
16
+
17
+ RUN echo "Cloning comfyui-inpaint-nodes..." && \
18
+ git clone https://github.com/Acly/comfyui-inpaint-nodes.git custom_nodes/comfyui-inpaint-nodes || \
19
+ echo "Failed to clone comfyui-inpaint-nodes"
20
+
21
+ RUN echo "Cloning rgthree-comfy..." && \
22
+ git clone https://github.com/rgthree/rgthree-comfy.git custom_nodes/rgthree-comfy || \
23
+ echo "Failed to clone rgthree-comfy"
24
+
25
+ # List contents of custom_nodes/ for debugging
26
+ RUN echo "Contents of custom_nodes/:" && \
27
+ ls -la custom_nodes/ && \
28
+ echo "Contents of ComfyUI-YoloWorld-EfficientSAM:" && \
29
+ ls -la custom_nodes/ComfyUI-YoloWorld-EfficientSAM || echo "ComfyUI-YoloWorld-EfficientSAM not found" && \
30
+ echo "Contents of comfyui-inpaint-nodes:" && \
31
+ ls -la custom_nodes/comfyui-inpaint-nodes || echo "comfyui-inpaint-nodes not found" && \
32
+ echo "Contents of rgthree-comfy:" && \
33
+ ls -la custom_nodes/rgthree-comfy || echo "rgthree-comfy not found"
34
 
35
  # Install dependencies for custom nodes (if they have requirements.txt)
36
+ RUN if [ -f "custom_nodes/ComfyUI-YoloWorld-EfficientSAM/requirements.txt" ]; then \
37
+ echo "Installing dependencies for ComfyUI-YoloWorld-EfficientSAM..." && \
38
+ pip install -r custom_nodes/ComfyUI-YoloWorld-EfficientSAM/requirements.txt || \
39
+ echo "Failed to install dependencies for ComfyUI-YoloWorld-EfficientSAM"; \
40
+ else \
41
+ echo "No requirements.txt found for ComfyUI-YoloWorld-EfficientSAM"; \
42
+ fi
43
+
44
+ RUN if [ -f "custom_nodes/comfyui-inpaint-nodes/requirements.txt" ]; then \
45
+ echo "Installing dependencies for comfyui-inpaint-nodes..." && \
46
+ pip install -r custom_nodes/comfyui-inpaint-nodes/requirements.txt || \
47
+ echo "Failed to install dependencies for comfyui-inpaint-nodes"; \
48
+ else \
49
+ echo "No requirements.txt found for comfyui-inpaint-nodes"; \
50
+ fi
51
+
52
+ RUN if [ -f "custom_nodes/rgthree-comfy/requirements.txt" ]; then \
53
+ echo "Installing dependencies for rgthree-comfy..." && \
54
+ pip install -r custom_nodes/rgthree-comfy/requirements.txt || \
55
+ echo "Failed to install dependencies for rgthree-comfy"; \
56
+ else \
57
+ echo "No requirements.txt found for rgthree-comfy"; \
58
+ fi
59
+
60
+ # Install additional dependencies for ComfyUI-YoloWorld-EfficientSAM
61
+ RUN pip install efficient-sam
62
 
63
  # Install dependencies
64
  RUN pip install --no-cache-dir --upgrade pip
app.py CHANGED
@@ -180,6 +180,8 @@ def import_custom_nodes() -> None:
180
  import execution
181
  from nodes import init_extra_nodes
182
  import server
 
 
183
 
184
  # Debug: List contents of custom_nodes/
185
  print("Custom nodes directory contents:", os.listdir('custom_nodes'))
@@ -187,6 +189,24 @@ def import_custom_nodes() -> None:
187
  node_path = os.path.join('custom_nodes', node_dir)
188
  if os.path.isdir(node_path):
189
  print(f"Contents of {node_dir}:", os.listdir(node_path))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
  # Creating a new event loop and setting it as the default loop
192
  loop = asyncio.new_event_loop()
@@ -200,7 +220,11 @@ def import_custom_nodes() -> None:
200
  execution.PromptQueue(server_instance)
201
 
202
  # Initializing custom nodes
203
- init_extra_nodes()
 
 
 
 
204
 
205
  print("Custom Nodes Loaded:", NODE_CLASS_MAPPINGS.keys())
206
 
 
180
  import execution
181
  from nodes import init_extra_nodes
182
  import server
183
+ import importlib.util
184
+ import traceback
185
 
186
  # Debug: List contents of custom_nodes/
187
  print("Custom nodes directory contents:", os.listdir('custom_nodes'))
 
189
  node_path = os.path.join('custom_nodes', node_dir)
190
  if os.path.isdir(node_path):
191
  print(f"Contents of {node_dir}:", os.listdir(node_path))
192
+ # Check if __init__.py exists
193
+ init_path = os.path.join(node_path, '__init__.py')
194
+ print(f"__init__.py exists in {node_dir}: {os.path.exists(init_path)}")
195
+ if os.path.exists(init_path):
196
+ # Attempt to import the module
197
+ try:
198
+ module_name = f"custom_nodes.{node_dir}"
199
+ spec = importlib.util.spec_from_file_location(module_name, init_path)
200
+ if spec is None:
201
+ print(f"Failed to create spec for {module_name}")
202
+ continue
203
+ module = importlib.util.module_from_spec(spec)
204
+ sys.modules[module_name] = module
205
+ spec.loader.exec_module(module)
206
+ print(f"Successfully imported {module_name}")
207
+ except Exception as e:
208
+ print(f"Failed to import {node_dir}: {str(e)}")
209
+ traceback.print_exc()
210
 
211
  # Creating a new event loop and setting it as the default loop
212
  loop = asyncio.new_event_loop()
 
220
  execution.PromptQueue(server_instance)
221
 
222
  # Initializing custom nodes
223
+ try:
224
+ init_extra_nodes()
225
+ except Exception as e:
226
+ print(f"Error in init_extra_nodes(): {str(e)}")
227
+ traceback.print_exc()
228
 
229
  print("Custom Nodes Loaded:", NODE_CLASS_MAPPINGS.keys())
230