mirror of
https://github.com/N0rthernL1ghts/wordpress.git
synced 2025-02-08 13:09:30 +01:00
Improve code, implement cache
This commit is contained in:
parent
f5355e6a8e
commit
0e7cc38249
|
@ -3,6 +3,8 @@
|
||||||
WP_VERSIONS=${1:-""}
|
WP_VERSIONS=${1:-""}
|
||||||
WP_LATEST_VERSION=${2:-""}
|
WP_LATEST_VERSION=${2:-""}
|
||||||
|
|
||||||
|
CACHE_DIR="/tmp/.buildx-cache"
|
||||||
|
|
||||||
if [ -z "${WP_VERSIONS}" ]; then
|
if [ -z "${WP_VERSIONS}" ]; then
|
||||||
echo "Error: WP_VERSIONS is null"
|
echo "Error: WP_VERSIONS is null"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -14,9 +16,16 @@ docker buildx create --use --name build --node build --driver-opt network=host
|
||||||
for TARGET_VERSION in ${WP_VERSIONS}; do
|
for TARGET_VERSION in ${WP_VERSIONS}; do
|
||||||
echo "> Building WordPress ${TARGET_VERSION}"
|
echo "> Building WordPress ${TARGET_VERSION}"
|
||||||
|
|
||||||
docker buildx build --pull --push --build-arg "WP_VERSION=${TARGET_VERSION}" --platform "linux/amd64,linux/armhf,linux/aarch64" --tag "nlss/wordpress:${TARGET_VERSION}" .
|
|
||||||
|
|
||||||
if [ "${TARGET_VERSION}" = "${WP_LATEST_VERSION}" ]; then
|
if [ "${TARGET_VERSION}" = "${WP_LATEST_VERSION}" ]; then
|
||||||
docker buildx build --pull --push --build-arg "WP_VERSION=${TARGET_VERSION}" --platform "linux/amd64,linux/armhf,linux/aarch64" --tag "nlss/wordpress:latest" .
|
TARGET_VERSION="latest"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
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}" .
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue
Block a user