44 lines
1.2 KiB
Bash
Executable file
44 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
set -e
|
|
# Source: https://danmanners.com/posts/2022-01-buildah-multi-arch/
|
|
|
|
# Set your manifest name
|
|
export MANIFEST_NAME="ucast"
|
|
|
|
# Set the required variables
|
|
export BUILD_PATH="."
|
|
export DOCKERFILE="deploy/Dockerfile"
|
|
export REGISTRY="registry.hub.docker.com"
|
|
export USER="thetadev256"
|
|
export IMAGE_NAME="ucast"
|
|
export IMAGE_TAG="v0.3.2"
|
|
|
|
# Create a multi-architecture manifest
|
|
buildah manifest create ${MANIFEST_NAME}
|
|
|
|
# Build your amd64 architecture container
|
|
buildah bud \
|
|
--tag "${REGISTRY}/${USER}/${IMAGE_NAME}:${IMAGE_TAG}" \
|
|
--manifest ${MANIFEST_NAME} \
|
|
--arch amd64 \
|
|
--build-arg TARGETPLATFORM=linux/amd64 \
|
|
-f ${DOCKERFILE} \
|
|
${BUILD_PATH}
|
|
|
|
# Build your arm64 architecture container
|
|
buildah bud \
|
|
--tag "${REGISTRY}/${USER}/${IMAGE_NAME}:${IMAGE_TAG}" \
|
|
--manifest ${MANIFEST_NAME} \
|
|
--arch arm64 \
|
|
--build-arg TARGETPLATFORM=linux/arm64 \
|
|
-f ${DOCKERFILE} \
|
|
${BUILD_PATH}
|
|
|
|
# Push the full manifest, with both CPU Architectures
|
|
buildah manifest push --all \
|
|
${MANIFEST_NAME} \
|
|
"docker://${REGISTRY}/${USER}/${IMAGE_NAME}:${IMAGE_TAG}"
|
|
|
|
buildah manifest push --all \
|
|
${MANIFEST_NAME} \
|
|
"docker://${REGISTRY}/${USER}/${IMAGE_NAME}"
|