Skip to content

Commit

Permalink
use docker buildx push
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkroh committed Mar 21, 2024
1 parent fea7e1a commit fea28b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .buildkite/scripts/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo ":: Building image - ${commit_tag} ::"
build_image "${commit_tag}" "${base_commit}"

echo ":: Pushing image - ${commit_tag} ::"
retry 3 docker push "${commit_tag}"
push_image "${commit_tag}" "${base_commit}"

echo ":: Re-tagging image from ${commit_tag} to ${branch_tag} ::"
retry 3 docker tag "${commit_tag}" "${branch_tag}"
Expand Down
25 changes: 12 additions & 13 deletions .buildkite/scripts/image-util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,29 @@ build_image() {
local commit_tag=$1
local base_commit=$2

echo ":: Building amd64 image"
docker build \
docker buildx build \
--progress=plain \
-t "${commit_tag}-amd64" \
--platform linux/amd64,linux/arm64 \
-t "${commit_tag}" \
--label BRANCH_NAME="${BUILDKITE_BRANCH}" \
--label GIT_SHA="${base_commit}" \
--label GO_VERSION="${GOLANG_VERSION}" \
--label TIMESTAMP="$(date +%Y-%m-%d_%H:%M)" \
.
}

echo ":: Building arm64 image"
docker buildx build \
push_image() {
local commit_tag=$1
local base_commit=$2

retry 3 docker buildx build \
--progress=plain \
--platform linux/arm64 \
-t "${commit_tag}-arm64" \
--load \
--platform linux/amd64,linux/arm64 \
-t "${commit_tag}" \
--label BRANCH_NAME="${BUILDKITE_BRANCH}" \
--label GIT_SHA="${base_commit}" \
--label GO_VERSION="${GOLANG_VERSION}" \
--label TIMESTAMP="$(date +%Y-%m-%d_%H:%M)" \
--push \
.

echo ":: Building multi-arch image"
docker manifest create "${commit_tag}" \
--amend "${commit_tag}-amd64" \
--amend "${commit_tag}-arm64"
}

0 comments on commit fea28b5

Please sign in to comment.