Skip to content

Commit a666980

Browse files
committed
Build multiarch (amd64 and arm64) images
Makes changes to the scripts in build/tools to build and push multiarch images. Now runs two `docker build` commands to build images for individual architectures, and an additional `docker manifest create` to create the multiarch manifest. When pushing `docker manifest push` is used instead of `docker push`. Signed-off-by: Zoran Regvart <[email protected]>
1 parent bb7f749 commit a666980

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

build/tools/builder.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,21 @@ function build_cli_for_all() {
103103

104104
function build_oci() {
105105
local tag_prefix=$1
106-
local os=linux
107-
local arch=amd64
106+
local os=$2
107+
local arch=$3
108108

109-
docker build --platform $os/$arch --build-arg NOOBAA_BIN_PATH=$(generate_full_bin_path $os $arch) -t $tag_prefix/noobaa-operator:$(get_noobaa_version) -f build/Dockerfile .
109+
docker build --platform $os/$arch --build-arg NOOBAA_BIN_PATH=$(generate_full_bin_path $os $arch) -t $tag_prefix/noobaa-operator:${os}-${arch}-$(get_noobaa_version) -f build/Dockerfile .
110+
}
111+
112+
function build_oci_for_all() {
113+
local repository=$1
114+
build_oci "${repository}" linux amd64
115+
build_oci "${repository}" linux arm64
116+
117+
local version=$(get_noobaa_version)
118+
docker manifest create "${repository}/noobaa-operator:${version}" \
119+
--amend "${repository}/noobaa-operator:linux-amd64-${version}" \
120+
--amend "${repository}/noobaa-operator:linux-arm64-${version}"
110121
}
111122

112123
function generate_krew_manifest() {
@@ -209,7 +220,7 @@ function generate_operator_bundle() {
209220
function main() {
210221
check_deps "${dependencies[@]}"
211222
build_cli_for_all
212-
build_oci ${OCI_ORG:-noobaa}
223+
build_oci_for_all ${OCI_ORG:-noobaa}
213224
generate_krew_manifest
214225
generate_homebrew_formula
215226
generate_operator_bundle

build/tools/releaser.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,13 @@ function create_oci_release() {
201201
echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
202202

203203
echo "Pushing the images to docker.io..."
204-
docker push $docker_image
204+
docker manifest push $docker_image
205205

206206
echo "Logging in to quay.io..."
207207
echo "$QUAY_TOKEN" | docker login -u "$QUAY_USERNAME" --password-stdin quay.io
208208

209209
echo "Pushing the images to quay.io..."
210-
docker push $quay_image
210+
docker manifest push $quay_image
211211
}
212212

213213
function create_krew() {

0 commit comments

Comments
 (0)