2023-11-15 19:33:24 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-11-21 19:43:04 +00:00
|
|
|
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
|
|
|
source "${ABSDIR}"/../functions.sh
|
|
|
|
source "${ABSDIR}"/vars.sh
|
|
|
|
|
|
|
|
ensure_pwd_is_scriptdir
|
|
|
|
ensure_not_root
|
|
|
|
|
2023-11-21 20:13:21 +00:00
|
|
|
php='php8.1'
|
2023-11-21 19:43:04 +00:00
|
|
|
flavor='apache'
|
|
|
|
buildfolder=/tmp/wp-$$
|
|
|
|
|
|
|
|
mkdir ${buildfolder} &&
|
|
|
|
if git clone --depth=1 https://github.com/docker-library/wordpress.git ${buildfolder} ; then
|
|
|
|
wp_version=$(grep -Po "version=\'\K[0-9.]*" ${buildfolder}/latest/${php}/${flavor}/Dockerfile)
|
|
|
|
if ! podman image exists ${wp_image}:${wp_version}-${php}-${flavor}; then
|
|
|
|
TMPDIR=${HOME} podman build \
|
|
|
|
-t ${wp_image}:${wp_version}-${php}-${flavor} \
|
|
|
|
-f ${buildfolder}/latest/${php}/${flavor}/Dockerfile \
|
|
|
|
${buildfolder}/latest/${php}/${flavor}/ || retval=false
|
|
|
|
podman image prune -a -f --filter dangling=true
|
|
|
|
podman image prune -a -f --filter intermediate=true
|
|
|
|
fi
|
|
|
|
rm -rf ${buildfolder}
|
|
|
|
eval "$retval"
|
|
|
|
else
|
|
|
|
echo "Image ${wp_image}:${wp_version}-${php}-${flavor} already built"
|
|
|
|
fi &&
|
|
|
|
|
|
|
|
oci_push_to_registry ${wp_image}:${wp_version}-${php}-${flavor}
|