Stanislav N. aka pztrn
6590e5bd40
All checks were successful
continuous-integration/drone/push Build is passing
31 lines
1.3 KiB
Bash
Executable File
31 lines
1.3 KiB
Bash
Executable File
#!/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}"
|