Added ComfyUI-Manager support, made changes to .sh file to create volume for custom_nodes

This commit is contained in:
RedsAnalysis 2025-03-15 06:26:59 -04:00
parent b460dd62df
commit 34b77380c2
3 changed files with 26 additions and 10 deletions

View File

@ -58,4 +58,4 @@ RUN . venv/bin/activate && pip install -r /app/comfyui/custom_nodes/ComfyUI-Mana
EXPOSE 8188 EXPOSE 8188
# Set the entrypoint command to activate the virtual environment and run the script # Set the entrypoint command to activate the virtual environment and run the script
CMD ["/bin/bash", "-c", "source /app/venv/bin/activate && python3 /app/comfyui/main.py --listen 0.0.0.0 --port 8188 && echo 'Server started and ready to accept requests'"] CMD ["/bin/bash", "-c", "source /app/venv/bin/activate && python3 /app/comfyui/main.py --listen 0.0.0.0 --port 8188"]

View File

@ -58,6 +58,21 @@ else
exit 1 exit 1
fi fi
# Step 4: Copy the 'ComfyUI-Manager' directory from the container to the host
echo "Checking if /app/comfyui/custom_nodes/ComfyUI-Manager exists in the container..."
if docker exec "$container_name" ls /app/comfyui/custom_nodes/ComfyUI-Manager; then
echo "Copying the ComfyUI-Manager from the container to the host..."
if ! docker cp "$container_name:/app/comfyui/custom_nodes/ComfyUI-Manager" ./custom_nodes/ComfyUI-Manager; then
echo "Failed to copy the ComfyUI-Manager. Exiting."
exit 1
else
echo "ComfyUI-Manager copied successfully."
fi
else
echo "/app/comfyui/custom_nodes/ComfyUI-Manager does not exist in the container. Exiting."
exit 1
fi
# Step 5: Stop the container # Step 5: Stop the container
echo "Stopping the container..." echo "Stopping the container..."
docker-compose down docker-compose down
@ -72,20 +87,20 @@ fi
echo "Updating Docker Compose file to mount the virtual environment..." echo "Updating Docker Compose file to mount the virtual environment..."
sed -i '/# Mount the venv directory for persistence/a \ \ \ \ \ \ - ./venv:/app/venv' docker-compose.yml sed -i '/# Mount the venv directory for persistence/a \ \ \ \ \ \ - ./venv:/app/venv' docker-compose.yml
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Docker Compose file updated successfully." echo "Docker Compose file updated to include venv."
else else
echo "Failed to update Docker Compose file. Exiting." echo "Failed to update Docker Compose file. Exiting."
exit 1 exit 1
fi fi
# Step 7: Restart the container with the venv volume mounted # Step 6: Update the Docker Compose file to mount the venv volume
echo "Restarting the container with the virtual environment mounted..." echo "Updating Docker Compose file to mount the custom_nodes..."
docker-compose up -d sed -i '/# Mount the custom nodes directory directly inside/a \ \ \ \ \ \ - ./custom_nodes:/app/comfyui/custom_nodes' docker-compose.yml
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Container restarted successfully." echo "Docker Compose file updated to include custom_nodes."
else else
echo "Failed to restart the container. Exiting." echo "Failed to update Docker Compose file. Exiting."
exit 1 exit 1
fi fi
echo "Setup complete! The container is running with the virtual environment persisted at ./venv." echo "Setup complete! you can use "docker-compose up" to start the container."

View File

@ -11,11 +11,12 @@ services:
- ./input:/app/comfyui/input # Mount the input directory directly inside /app/comfyui - ./input:/app/comfyui/input # Mount the input directory directly inside /app/comfyui
- ./models:/app/comfyui/models # Mount the models directory directly inside /app/comfyui - ./models:/app/comfyui/models # Mount the models directory directly inside /app/comfyui
- ./output:/app/comfyui/output # Mount the output directory directly inside /app/comfyui - ./output:/app/comfyui/output # Mount the output directory directly inside /app/comfyui
- ./custom_nodes:/app/comfyui/custom_nodes # Mount the custom nodes directory directly inside /app/comfyui
- ./user:/app/comfyui/user # Comment this line and uncomment the next line if you want to have a workflows directory in the root directory. - ./user:/app/comfyui/user # Comment this line and uncomment the next line if you want to have a workflows directory in the root directory.
#- ./workflows:/app/comfyui/user/default/workflows #- ./workflows:/app/comfyui/user/default/workflows
# Mount the venv directory for persistence(automatically mounted with you run docker-build.sh) # Mount the venv directory for persistence (automatically mounted with you run docker-build.sh)
# Mount the custom nodes directory directly inside /app/comfyui (automatically mounted with you run docker-build.sh)
environment: environment: