Script for multiarch image.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c2977ada4d
commit
6590e5bd40
30
build_multiarch.sh
Executable file
30
build_multiarch.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script builds arm64 toolbox image, pushes it to packages and create version manifest with
|
||||
# both amd64 and arm64 images.
|
||||
# This script is launched on my local machine (which is macbook with M2 Pro CPU) and uses
|
||||
# lima with arm64 version of Docker.
|
||||
|
||||
IMAGE_NAME="code.pztrn.name/containers/go-toolbox"
|
||||
VERSION=$1
|
||||
|
||||
if [ "${VERSION}" == "" ]; then
|
||||
echo "! No version specified as first argument!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "* Building multiarch image with amd64 and arm64 images for version '${VERSION}'..."
|
||||
echo "* Pulling ${IMAGE_NAME}:${VERSION} (amd64)..."
|
||||
docker pull "${IMAGE_NAME}:${VERSION}"
|
||||
echo "* Retagging pulled image as ${IMAGE_NAME}:${VERSION}-amd64..."
|
||||
docker image tag "${IMAGE_NAME}:${VERSION}" "${IMAGE_NAME}:${VERSION}-amd64"
|
||||
echo "* Pushing ${IMAGE_NAME}:${VERSION}-amd64..."
|
||||
docker push "${IMAGE_NAME}:${VERSION}-amd64"
|
||||
echo "* Building arm64 version..."
|
||||
docker build -t "${IMAGE_NAME}:${VERSION}-arm64" .
|
||||
echo "* Pushing arm64 image..."
|
||||
docker push "${IMAGE_NAME}:${VERSION}-arm64"
|
||||
echo "* Creating multiarch manifest..."
|
||||
docker manifest create "${IMAGE_NAME}:${VERSION}" "${IMAGE_NAME}:${VERSION}-amd64" "${IMAGE_NAME}:${VERSION}-arm64"
|
||||
echo "* Pushing multiarch manifest as ${IMAGE_NAME}:${VERSION}..."
|
||||
docker manifest push "${IMAGE_NAME}:${VERSION}"
|
Loading…
Reference in New Issue
Block a user