docker: optimize env and syzbot images using multi-stage builds#7474
docker: optimize env and syzbot images using multi-stage builds#7474tarasmadan wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request consolidates the Docker build process for syzkaller by replacing individual Dockerfiles with a single multi-stage Dockerfile and introducing a build.sh helper script. Feedback on these changes includes addressing a hardcoded amd64 architecture during the Go toolchain download to support multi-platform builds, setting the LIBCLANG_PATH environment variable so that bindgen can locate libclang.so at runtime, and refactoring BUILD_ARGS in build.sh to use a bash array to prevent word-splitting issues.
4fea5f7 to
80e73d8
Compare
|
The tests are failing because the actual containers were not yet uploaded. |
|
Note that this patch won't apply because we switched to clang-22 today |
80e73d8 to
285cc4d
Compare
Combine tools/docker/env/Dockerfile and tools/docker/syzbot/Dockerfile into a single multi-stage Dockerfile. This allows the images to share common base layers (like LLVM and Go) and reduces the maintenance burden. Additionally, split the syz-env image into variants (base, arch, dashboard) so that CI jobs only download the components they need, significantly reducing CI download times. Also: - Fixed Go toolchain download to use dynamic architecture (fixing arm64 support). - Set LIBCLANG_PATH in env-base for bindgen runtime compatibility. - Refactored build.sh to use a bash array for build arguments. - Added tools/docker/test.sh sanity test script to verify all target images. Measurable Impact (Size Savings): | Image Variant | Target Job | Download Size | On-Disk Size | Reduction vs Original | | :--- | :--- | :--- | :--- | :--- | | env:base | aux, build, race | 636 MB | 2.81 GB | ~80% smaller (from 3.2GB / 14.7GB) | | env:dashboard | dashboard | 1.01 GB | 4.64 GB | ~68% smaller | | env:arch | arch | 2.08 GB | 9.07 GB | ~38% smaller | | env:latest (Full) | Local Dev | 2.80 GB | 12.80 GB | ~13% smaller | | syzbot:latest | syzbot | 2.27 GB | 10.50 GB | ~20% smaller (from 2.75GB / 13.2GB) | For CI, the core build/test jobs will now download a 636MB image instead of 3.2GB, saving ~2.5GB of network transfer per workflow run and significantly reducing startup latency.
285cc4d to
4a96976
Compare
Combine tools/docker/env/Dockerfile and tools/docker/syzbot/Dockerfile
into a single multi-stage Dockerfile. This allows the images to share
common base layers (like LLVM and Go) and reduces the maintenance burden.
Additionally, split the syz-env image into variants (base, arch, dashboard)
so that CI jobs only download the components they need, significantly
reducing CI download times.
Measurable Impact (Size Savings):
For CI, the core build/test jobs will now download a 636MB image instead of 3.2GB, saving ~2.5GB of network transfer per workflow run and significantly reducing startup latency.