diff --git a/podman-wpamapsta/ci_build-images.sh b/podman-wpamapsta/ci_build-images.sh index cf93aea..b0c9c14 100644 --- a/podman-wpamapsta/ci_build-images.sh +++ b/podman-wpamapsta/ci_build-images.sh @@ -1,6 +1,31 @@ #!/usr/bin/env bash -# TODO : FIX BUILD -git clone --depth=1 https://github.com/docker-library/wordpress.git -cd wordpress/latest/php8.0/apache/ -podman build -t ${wp_image}:${wp_version} . +ABSDIR="$( dirname "$(readlink -f -- "$0")" )" +source "${ABSDIR}"/../functions.sh +source "${ABSDIR}"/vars.sh + +ensure_pwd_is_scriptdir +ensure_not_root + +php='php8.0' +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}