Skip to content

Commit

Permalink
Add an architecture suffix to images pushed for multi-platform
Browse files Browse the repository at this point in the history
In order to reduce the likelihood of users accidentally forgetting to
specify unique tags for each architecture, we can add a suffix to the
pushed image

Signed-off-by: arewm <[email protected]>
  • Loading branch information
arewm committed Jul 23, 2024
1 parent 6dd763a commit 252aeab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions task/buildah/0.2/buildah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ spec:
update-ca-trust
fi
# If a platform is specified, ensure that the image tag is mapped to this platform
# to reduce the likelihood of accidentally stepping on other images being built.
export ARCH=$(echo `uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`)
if [ -n "${PLATFORM}" ]; then
if [ "${IMAGE##*-}" -neq "$ARCH" ]; then
export IMAGE="${IMAGE}-${ARCH}"
fi
fi
SOURCE_CODE_DIR=source
if [ -e "$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE" ]; then
dockerfile_path="$(pwd)/$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE"
Expand Down

0 comments on commit 252aeab

Please sign in to comment.