Skip to content

Commit

Permalink
Build multiarch (amd64 and arm64) images
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
zregvart committed Jan 22, 2025
1 parent f324757 commit 403a7fe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
19 changes: 15 additions & 4 deletions build/tools/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,21 @@ function build_cli_for_all() {

function build_oci() {
local tag_prefix=$1
local os=linux
local arch=amd64
local os=$2
local arch=$3

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 .
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 .
}

function build_oci_for_all() {
local repository=$1
build_oci "${repository}" linux amd64
build_oci "${repository}" linux arm64

local version=$(get_noobaa_version)
docker manifest create "${repository}/noobaa-operator:${version}" \
--amend "${repository}/noobaa-operator:linux-amd64-${version}" \
--amend "${repository}/noobaa-operator:linux-arm64-${version}"
}

function generate_krew_manifest() {
Expand Down Expand Up @@ -209,7 +220,7 @@ function generate_operator_bundle() {
function main() {
check_deps "${dependencies[@]}"
build_cli_for_all
build_oci ${OCI_ORG:-noobaa}
build_oci_for_all ${OCI_ORG:-noobaa}
generate_krew_manifest
generate_homebrew_formula
generate_operator_bundle
Expand Down
4 changes: 2 additions & 2 deletions build/tools/releaser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ function create_oci_release() {
echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin

echo "Pushing the images to docker.io..."
docker push $docker_image
docker manifest push $docker_image

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

echo "Pushing the images to quay.io..."
docker push $quay_image
docker manifest push $quay_image
}

function create_krew() {
Expand Down

0 comments on commit 403a7fe

Please sign in to comment.