Fix image tagging problem where latest version is not tagged as litteral

This commit is contained in:
xZero707 2021-09-24 23:25:47 +02:00
parent 0e7cc38249
commit d96df7e064

View File

@ -1,7 +1,8 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
WP_VERSIONS=${1:-""}
WP_LATEST_VERSION=${2:-""}
TARGET_PLATFORMS="linux/amd64,linux/armhf,linux/aarch64"
CACHE_DIR="/tmp/.buildx-cache"
@ -16,16 +17,18 @@ docker buildx create --use --name build --node build --driver-opt network=host
for TARGET_VERSION in ${WP_VERSIONS}; do
echo "> Building WordPress ${TARGET_VERSION}"
IMAGE_TAGS="--tag nlss/wordpress:${TARGET_VERSION}"
if [ "${TARGET_VERSION}" = "${WP_LATEST_VERSION}" ]; then
TARGET_VERSION="latest"
IMAGE_TAGS="${IMAGE_TAGS} --tag nlss/wordpress:latest"
fi
docker buildx build \
docker buildx build . \
--pull \
--push \
--cache-from "type=local,src=${CACHE_DIR}" \
--cache-to "type=local,dest=${CACHE_DIR}" \
--build-arg "WP_VERSION=${TARGET_VERSION}" \
--platform "linux/amd64,linux/armhf,linux/aarch64" \
--tag "nlss/wordpress:${TARGET_VERSION}" .
--platform "${TARGET_PLATFORMS}" \
${IMAGE_TAGS[@]}
done