Skip to content

Commit a4fefe4

Browse files
committed
feat(docker): add z-image-turbo image with alibaba tongyi models
- add z-image-turbo target to docker-bake.hcl default group - download qwen_3_4b text encoder, z_image_turbo_bf16 diffusion model, ae vae, and z-image-turbo-fun-controlnet-union model patch - add build-z-image-turbo job to manual-build-all workflow
1 parent d0f6992 commit a4fefe4

File tree

3 files changed

+77
-2
lines changed

3 files changed

+77
-2
lines changed

.github/workflows/manual-build-all.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,57 @@ jobs:
366366
*.args.RELEASE_VERSION=${{ env.RELEASE_VERSION }}
367367
*.args.HUGGINGFACE_ACCESS_TOKEN=${{ env.HUGGINGFACE_ACCESS_TOKEN }}
368368
369+
build-z-image-turbo:
370+
runs-on: [blacksmith-8vcpu-ubuntu-2204, linux]
371+
permissions:
372+
contents: read
373+
374+
steps:
375+
- name: Checkout
376+
uses: actions/checkout@v3
377+
378+
- name: Clear space to remove unused folders
379+
run: |
380+
rm -rf /usr/share/dotnet
381+
rm -rf /opt/ghc
382+
rm -rf "/usr/local/share/boost"
383+
rm -rf "$AGENT_TOOLSDIRECTORY"
384+
385+
- name: Set up QEMU
386+
uses: docker/setup-qemu-action@v3
387+
388+
- name: Set up Docker Buildx
389+
uses: docker/setup-buildx-action@v3
390+
391+
- name: Login to Docker Hub
392+
uses: docker/login-action@v3
393+
with:
394+
username: ${{ secrets.DOCKERHUB_USERNAME }}
395+
password: ${{ secrets.DOCKERHUB_TOKEN }}
396+
397+
- name: blacksmith docker layer cache
398+
uses: useblacksmith/build-push-action@v1
399+
with:
400+
setup-only: true
401+
402+
- name: Set environment variables
403+
run: |
404+
echo "DOCKERHUB_REPO=${{ vars.DOCKERHUB_REPO }}" >> $GITHUB_ENV
405+
echo "DOCKERHUB_IMG=${{ vars.DOCKERHUB_IMG }}" >> $GITHUB_ENV
406+
echo "HUGGINGFACE_ACCESS_TOKEN=${{ secrets.HUGGINGFACE_ACCESS_TOKEN }}" >> $GITHUB_ENV
407+
echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
408+
409+
- name: Build and push z-image-turbo image
410+
uses: docker/bake-action@v2
411+
with:
412+
push: true
413+
targets: z-image-turbo
414+
set: |
415+
*.args.DOCKERHUB_REPO=${{ env.DOCKERHUB_REPO }}
416+
*.args.DOCKERHUB_IMG=${{ env.DOCKERHUB_IMG }}
417+
*.args.RELEASE_VERSION=${{ env.RELEASE_VERSION }}
418+
*.args.HUGGINGFACE_ACCESS_TOKEN=${{ env.HUGGINGFACE_ACCESS_TOKEN }}
419+
369420
update-dockerhub-description:
370421
runs-on: [blacksmith-8vcpu-ubuntu-2204, linux]
371422
needs:
@@ -377,6 +428,7 @@ jobs:
377428
build-flux1-schnell,
378429
build-flux1-dev,
379430
build-flux1-dev-fp8,
431+
build-z-image-turbo,
380432
]
381433
permissions:
382434
contents: read

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ ARG MODEL_TYPE=flux1-dev-fp8
102102
WORKDIR /comfyui
103103

104104
# Create necessary directories upfront
105-
RUN mkdir -p models/checkpoints models/vae models/unet models/clip
105+
RUN mkdir -p models/checkpoints models/vae models/unet models/clip models/text_encoders models/diffusion_models models/model_patches
106106

107107
# Download checkpoints/vae/unet/clip models to include in image based on model type
108108
RUN if [ "$MODEL_TYPE" = "sdxl" ]; then \
@@ -133,6 +133,13 @@ RUN if [ "$MODEL_TYPE" = "flux1-dev-fp8" ]; then \
133133
wget -q -O models/checkpoints/flux1-dev-fp8.safetensors https://huggingface.co/Comfy-Org/flux1-dev/resolve/main/flux1-dev-fp8.safetensors; \
134134
fi
135135

136+
RUN if [ "$MODEL_TYPE" = "z-image-turbo" ]; then \
137+
wget -q -O models/text_encoders/qwen_3_4b.safetensors https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/text_encoders/qwen_3_4b.safetensors && \
138+
wget -q -O models/diffusion_models/z_image_turbo_bf16.safetensors https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/diffusion_models/z_image_turbo_bf16.safetensors && \
139+
wget -q -O models/vae/ae.safetensors https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/vae/ae.safetensors && \
140+
wget -q -O models/model_patches/Z-Image-Turbo-Fun-Controlnet-Union.safetensors https://huggingface.co/alibaba-pai/Z-Image-Turbo-Fun-Controlnet-Union/resolve/main/Z-Image-Turbo-Fun-Controlnet-Union.safetensors; \
141+
fi
142+
136143
# Stage 3: Final image
137144
FROM base AS final
138145

docker-bake.hcl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ variable "HUGGINGFACE_ACCESS_TOKEN" {
3636
}
3737

3838
group "default" {
39-
targets = ["base", "sdxl", "sd3", "flux1-schnell", "flux1-dev", "flux1-dev-fp8", "base-cuda12-8-1"]
39+
targets = ["base", "sdxl", "sd3", "flux1-schnell", "flux1-dev", "flux1-dev-fp8", "z-image-turbo", "base-cuda12-8-1"]
4040
}
4141

4242
target "base" {
@@ -138,6 +138,22 @@ target "flux1-dev-fp8" {
138138
inherits = ["base"]
139139
}
140140

141+
target "z-image-turbo" {
142+
context = "."
143+
dockerfile = "Dockerfile"
144+
target = "final"
145+
args = {
146+
BASE_IMAGE = "${BASE_IMAGE}"
147+
COMFYUI_VERSION = "${COMFYUI_VERSION}"
148+
CUDA_VERSION_FOR_COMFY = "${CUDA_VERSION_FOR_COMFY}"
149+
ENABLE_PYTORCH_UPGRADE = "${ENABLE_PYTORCH_UPGRADE}"
150+
PYTORCH_INDEX_URL = "${PYTORCH_INDEX_URL}"
151+
MODEL_TYPE = "z-image-turbo"
152+
}
153+
tags = ["${DOCKERHUB_REPO}/${DOCKERHUB_IMG}:${RELEASE_VERSION}-z-image-turbo"]
154+
inherits = ["base"]
155+
}
156+
141157
target "base-cuda12-8-1" {
142158
context = "."
143159
dockerfile = "Dockerfile"

0 commit comments

Comments
 (0)