diff --git a/build/bin/build b/build/bin/build index e704aac..270b41b 100755 --- a/build/bin/build +++ b/build/bin/build @@ -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