multiarch!
This commit is contained in:
34
publish.sh
34
publish.sh
@@ -3,22 +3,34 @@
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
ARCH=$(uname -m)
|
||||
|
||||
# get date/time in local timezone, format YYYY.MMDD.HHMMSS
|
||||
DATETIME=$(date +%Y.%m%d.%H%M%S)
|
||||
echo "Publishing generic-docker-images to gitea.jde.nz/public/<image_name>:latest-${ARCH}"
|
||||
|
||||
"${SCRIPTDIR}/build.sh"
|
||||
function die() {
|
||||
echo "error: $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# iterate through the docker files in format Dockerfile.IMAGE_NAME
|
||||
# Build all images
|
||||
"${SCRIPTDIR}/build.sh" || die "Build failed"
|
||||
|
||||
# Iterate through the docker files in format Dockerfile.IMAGE_NAME
|
||||
for dockerfile in Dockerfile.*
|
||||
do
|
||||
# get the image name from the dockerfile
|
||||
# Get the image name from the dockerfile
|
||||
image_name="${dockerfile//Dockerfile./}"
|
||||
# tag the image with the latest tag
|
||||
docker tag "$image_name:latest" "gitea.jde.nz/public/$image_name:latest"
|
||||
docker tag "$image_name:latest" "gitea.jde.nz/public/$image_name:$DATETIME"
|
||||
# push the image to the local docker registry
|
||||
docker push -a "gitea.jde.nz/public/$image_name"
|
||||
|
||||
# Create and push the arch-specific docker image
|
||||
IMAGE_NAME="gitea.jde.nz/public/${image_name}:latest-${ARCH}"
|
||||
|
||||
# Tag the locally built image with arch-specific tag
|
||||
docker tag "${image_name}:latest" "${IMAGE_NAME}"
|
||||
|
||||
# Push the arch-specific image
|
||||
docker push "${IMAGE_NAME}"
|
||||
|
||||
echo "Pushed ${IMAGE_NAME}"
|
||||
done
|
||||
|
||||
|
||||
echo "All architecture-specific images pushed successfully"
|
Reference in New Issue
Block a user