YanWenKun / ComfyUI-Docker

🐳Dockerfile for 🎨ComfyUI. | 容器镜像与启动脚本
https://hub.docker.com/r/yanwk/comfyui-boot
Other
468 stars 87 forks source link

Is it possible to use Multi Stage Building to reduce image size? #62

Closed PeterTF656 closed 2 weeks ago

PeterTF656 commented 1 month ago

First of all, thank you for your work again! I have been using it for quite a while.

However, the current image size is around 7G. Is there a way to reduce the image size?

YanWenKun commented 1 month ago

Glad you like it!

To reduce image size for cu121-megapak and cu124-megapak, simply remove "NVIDIA CUDA devel" code block in Dockerfile. It only affects ComfyUI-3D-Pack and development usage. This could reduce image size by ~2.7GB.

I'm planning to remove CUDA devel packages in future cu127 tags. And for consistency, current tags will keep them.

As for multi stage building, since the Dockerfile is basically installing latest packages, it's more effective to use caching (work with --mount=type=cache in Dockerfile) to reduce download size when making builds everyday.