[PR #49] [MERGED] [build] Use buildx bake to make multi-platform images #274

Closed
opened 2026-03-04 01:36:01 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/spr-networks/super/pull/49
Author: @rgov
Created: 8/10/2022
Status: Merged
Merged: 8/12/2022
Merged by: @lts-rad

Base: mainHead: rzg/buildx-bake


📝 Commits (9)

  • 1304573 [ui] [build] Build the frontend for the native architecture
  • 1c1def8 [ui] [build] Only copy build products to container image
  • 0b82875 [build] Fix typo in argument
  • 9deb55a [build] Use buildx bake to make multi-platform images
  • e25fc39 [build] Build container images on all commits
  • 729508a [build] Do not pull frontend before build
  • 5dc7f3c [build] Make ramfs optional
  • 23ca318 [build] Update instructions in README
  • cfaf277 [ui] [build] Increase timeout for yarn install

📊 Changes

15 files changed (+100 additions, -55 deletions)

View changed files

📝 .github/workflows/docker-image.yml (+6 -13)
📝 README.md (+6 -5)
📝 api/Dockerfile (+4 -1)
📝 api_sample_plugin/Dockerfile (+4 -1)
📝 build_docker_compose.sh (+29 -15)
📝 dhcp/Dockerfile (+5 -3)
📝 dns/Dockerfile (+4 -2)
📝 dyndns/Dockerfile (+5 -3)
📝 flowgather/Dockerfile (+4 -1)
📝 frontend/Dockerfile (+9 -3)
📝 multicast_udp_proxy/Dockerfile (+8 -4)
📝 plugin-lookup/Dockerfile (+4 -1)
📝 superd/Dockerfile (+4 -1)
📝 wifid/Dockerfile (+4 -1)
📝 wireguard/Dockerfile (+4 -1)

📄 Description

An experiment to build multi-platform images in CI.

Multi-platform images in Docker are kind of a mess. You have to build them with a buildx builder. In this patch I modified build_docker_compose.sh to use buildx bake which is the buildx equivalent of docker compose.

Unfortunately, unlike docker build, with buildx build the resulting images are not automatically exposed under docker images, but you can pass --load to copy them over. Except, --load only works for single-platform images! So if you are building a multi-platform image, you pretty much have to push it directly to the registry. This is fine in CI, since that's probably what you want anyway, but it sucks for local development.

So I taught build_docker_compose.sh to determine if it is doing a single-platform build, and if so, it will automatically --load it into the local Docker image list.

Also, it doesn't attempt to push to the registry for pull requests, so contributed pull requests (like this one!) won't fail for lack of permissions.

This stacks on top of #48 and reimplements part of #30 (without the caching part).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/spr-networks/super/pull/49 **Author:** [@rgov](https://github.com/rgov) **Created:** 8/10/2022 **Status:** ✅ Merged **Merged:** 8/12/2022 **Merged by:** [@lts-rad](https://github.com/lts-rad) **Base:** `main` ← **Head:** `rzg/buildx-bake` --- ### 📝 Commits (9) - [`1304573`](https://github.com/spr-networks/super/commit/130457319e490c1934c754dac4a9f46c0a5b5b33) [ui] [build] Build the frontend for the native architecture - [`1c1def8`](https://github.com/spr-networks/super/commit/1c1def8cc40831dcdfb485f13344ada3dfdf3c70) [ui] [build] Only copy build products to container image - [`0b82875`](https://github.com/spr-networks/super/commit/0b82875e7fa71225ccbee746aa306209cf8beab1) [build] Fix typo in argument - [`9deb55a`](https://github.com/spr-networks/super/commit/9deb55acccb1f734de60f58fc1bad3298d6888a4) [build] Use buildx bake to make multi-platform images - [`e25fc39`](https://github.com/spr-networks/super/commit/e25fc3903cf62489087b4c9b35ea79ea546e6a80) [build] Build container images on all commits - [`729508a`](https://github.com/spr-networks/super/commit/729508a762a0a5713152b20efac8905c74928bfb) [build] Do not pull frontend before build - [`5dc7f3c`](https://github.com/spr-networks/super/commit/5dc7f3c5c41601f0b1f91f59a3069b6989a145ed) [build] Make ramfs optional - [`23ca318`](https://github.com/spr-networks/super/commit/23ca318d4fdc663dfdcc80b98a5c152d8079bed3) [build] Update instructions in README - [`cfaf277`](https://github.com/spr-networks/super/commit/cfaf277c31ab23e809297e06bcda86d7508fd105) [ui] [build] Increase timeout for yarn install ### 📊 Changes **15 files changed** (+100 additions, -55 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/docker-image.yml` (+6 -13) 📝 `README.md` (+6 -5) 📝 `api/Dockerfile` (+4 -1) 📝 `api_sample_plugin/Dockerfile` (+4 -1) 📝 `build_docker_compose.sh` (+29 -15) 📝 `dhcp/Dockerfile` (+5 -3) 📝 `dns/Dockerfile` (+4 -2) 📝 `dyndns/Dockerfile` (+5 -3) 📝 `flowgather/Dockerfile` (+4 -1) 📝 `frontend/Dockerfile` (+9 -3) 📝 `multicast_udp_proxy/Dockerfile` (+8 -4) 📝 `plugin-lookup/Dockerfile` (+4 -1) 📝 `superd/Dockerfile` (+4 -1) 📝 `wifid/Dockerfile` (+4 -1) 📝 `wireguard/Dockerfile` (+4 -1) </details> ### 📄 Description An experiment to build multi-platform images in CI. Multi-platform images in Docker are kind of a mess. You have to build them with a `buildx` builder. In this patch I modified `build_docker_compose.sh` to use `buildx bake` which is the `buildx` equivalent of `docker compose`. Unfortunately, unlike `docker build`, with `buildx build` the resulting images are not automatically exposed under `docker images`, but you can pass `--load` to copy them over. Except, `--load` only works for single-platform images! So if you are building a multi-platform image, you pretty much *have* to push it directly to the registry. This is fine in CI, since that's probably what you want anyway, but it sucks for local development. So I taught `build_docker_compose.sh` to determine if it is doing a *single*-platform build, and if so, it will automatically `--load` it into the local Docker image list. Also, it doesn't attempt to push to the registry for pull requests, so contributed pull requests (like this one!) won't fail for lack of permissions. This stacks on top of #48 and reimplements part of #30 (without the caching part). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 01:36:01 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/super#274
No description provided.