From 133e178d0593b8940eefcc8d960250d6de55e4ee Mon Sep 17 00:00:00 2001 From: Gitouche <26656-gitouche@users.noreply.framagit.org> Date: Sat, 28 Oct 2023 17:41:15 +0200 Subject: [PATCH] build image script : uniformisation --- podman-framadate/ci_build-images.sh | 9 ++++++++- podman-gitea/ci_build-images.sh | 3 ++- podman-hedgedoc/ci_build-images.sh | 16 ++++++++++------ podman-jitsi/ci_build-images.sh | 4 ++-- podman-matrix/ci_build-images.sh | 9 +++++++-- podman-ntfy/ci_build-images.sh | 5 +++-- podman-peerjs/ci_build-images.sh | 2 ++ podman-privatebin/ci_build-images.sh | 15 +++++++++++---- podman-seafile/ci_build-images.sh | 9 ++++++--- podman-vaultwarden/ci_build-images.sh | 24 ++++++++++++------------ 10 files changed, 63 insertions(+), 33 deletions(-) diff --git a/podman-framadate/ci_build-images.sh b/podman-framadate/ci_build-images.sh index 3d556cf..986de83 100755 --- a/podman-framadate/ci_build-images.sh +++ b/podman-framadate/ci_build-images.sh @@ -8,7 +8,14 @@ ensure_pwd_is_scriptdir ensure_not_root if ! podman image exists ${framadate_image}:${framadate_version}; then - podman image build -t "${framadate_image}":"${framadate_version}" --build-arg=version="${framadate_version}" container/ + podman image build \ + -t "${framadate_image}":"${framadate_version}" \ + --build-arg=version="${framadate_version}" \ + container/ || retval=false + podman image prune -a -f --filter dangling=true + podman image prune -a -f --filter intermediate=true + podman image rm -f $(podman image list -a -q -- docker.io/library/php) + eval "$retval" else echo "Image ${framadate_image}:${framadate_version} already built" fi && diff --git a/podman-gitea/ci_build-images.sh b/podman-gitea/ci_build-images.sh index f774112..b51ef6b 100755 --- a/podman-gitea/ci_build-images.sh +++ b/podman-gitea/ci_build-images.sh @@ -16,7 +16,8 @@ if ! podman image exists ${gitea_image}:${gitea_version}; then TMPDIR=${HOME} podman image build \ --label org.opencontainers.image.version="${gitea_version}" \ -t ${gitea_image}:${gitea_version} \ - -f ${buildfolder}/Dockerfile ${buildfolder} || retval=false + -f ${buildfolder}/Dockerfile \ + ${buildfolder} || retval=false podman image prune -a -f --filter dangling=true podman image prune -a -f --filter intermediate=true podman image rm -f $(podman image list -a -q -- docker.io/library/golang) diff --git a/podman-hedgedoc/ci_build-images.sh b/podman-hedgedoc/ci_build-images.sh index 7b4ba82..983356a 100755 --- a/podman-hedgedoc/ci_build-images.sh +++ b/podman-hedgedoc/ci_build-images.sh @@ -11,13 +11,17 @@ buildfolder=/tmp/hedgedoc-$$ if ! podman image exists ${hedgedoc_image}:${hedgedoc_version}; then mkdir ${buildfolder} && - if git clone --depth=1 https://github.com/hedgedoc/container ${buildfolder}/ ; then - TMPDIR=${HOME} podman image build -t ${hedgedoc_image}:${hedgedoc_version} -f ${buildfolder}/alpine/Dockerfile ${buildfolder}/ - fi || retval=false + if git clone --depth=1 https://github.com/hedgedoc/container ${buildfolder}/ ; then + rm -rf "${HOME}/buildah-cache-${UID}" + TMPDIR=${HOME} podman image build \ + -t ${hedgedoc_image}:${hedgedoc_version} \ + -f ${buildfolder}/alpine/Dockerfile \ + ${buildfolder}/ || retval=false + podman image prune -a -f --filter dangling=true + podman image prune -a -f --filter intermediate=true + podman image rm -f $(podman image list -a -q -- docker.io/library/node) + fi rm -rf ${buildfolder} - podman image prune -a -f --filter dangling=true - podman image prune -a -f --filter intermediate=true - podman image rm -f $(podman image list -a -q -- docker.io/library/node) eval "$retval" else echo "Image ${hedgedoc_image}:${hedgedoc_version} already built" diff --git a/podman-jitsi/ci_build-images.sh b/podman-jitsi/ci_build-images.sh index bdd2d01..8b9df12 100755 --- a/podman-jitsi/ci_build-images.sh +++ b/podman-jitsi/ci_build-images.sh @@ -40,8 +40,8 @@ if curl -sSfL -- "https://github.com/jitsi/docker-jitsi-meet/archive/refs/tags/$ build_base podman image build -t git.garbaye.fr/garbaye/jitsi-web:${version} ${buildfolder}/web/ || exit 255 fi - dangling_images=$(podman image list -f "dangling=true" -q) - [ -n "${dangling_images}" ] && podman image rm -f "${dangling_images}" + podman image prune -a -f --filter dangling=true + podman image prune -a -f --filter intermediate=true if [ -n "${base_cleanup}" ] ; then podman image rm localhost/jitsi/base-java:${version} localhost/jitsi/base-java:latest podman image rm localhost/jitsi/base:${version} localhost/jitsi/base:latest diff --git a/podman-matrix/ci_build-images.sh b/podman-matrix/ci_build-images.sh index ccd58fc..5a996a0 100755 --- a/podman-matrix/ci_build-images.sh +++ b/podman-matrix/ci_build-images.sh @@ -13,8 +13,13 @@ if ! podman image exists ${synapse_image}:${synapse_version}; then mkdir ${buildfolder} && if curl -sSfL -- "https://github.com/matrix-org/synapse/archive/refs/tags/${synapse_version}.tar.gz" | \tar xz --strip-components 1 -C ${buildfolder}/ ; then rm -rf "${HOME}/buildah-cache-${UID}" - TMPDIR=${HOME} podman image build -t ${synapse_image}:${synapse_version} -f ${buildfolder}/docker/Dockerfile ${buildfolder}/ && - podman image prune -f + TMPDIR=${HOME} podman image build \ + -t ${synapse_image}:${synapse_version} \ + -f ${buildfolder}/docker/Dockerfile \ + ${buildfolder}/ || retval=false + podman image prune -a -f --filter dangling=true + podman image prune -a -f --filter intermediate=true + podman image rm -f $(podman image list -a -q -- docker.io/library/python) fi rm -rf ${buildfolder} eval "$retval" diff --git a/podman-ntfy/ci_build-images.sh b/podman-ntfy/ci_build-images.sh index 481c701..90a8951 100755 --- a/podman-ntfy/ci_build-images.sh +++ b/podman-ntfy/ci_build-images.sh @@ -8,13 +8,14 @@ ensure_pwd_is_scriptdir ensure_not_root if ! podman image exists ${ntfy_image}:${ntfy_version}; then - TMPDIR=${HOME} podman image build -t "${ntfy_image}:${ntfy_version}" container/ --build-arg NTFY_VERSION=${ntfy_version} || exit 1 + TMPDIR=${HOME} podman image build -t "${ntfy_image}:${ntfy_version}" container/ --build-arg NTFY_VERSION=${ntfy_version} || retval=false podman image prune -a -f --filter dangling=true podman image prune -a -f --filter intermediate=true podman image rm -f $(podman image list -a -q -- docker.io/library/golang) podman image rm -f $(podman image list -a -q -- docker.io/library/alpine) + eval "$retval" else echo "Image ${ntfy_image}:${ntfy_version} already built" -fi +fi && oci_push_to_registry ${ntfy_image}:${ntfy_version} diff --git a/podman-peerjs/ci_build-images.sh b/podman-peerjs/ci_build-images.sh index 840c75b..ca91e3e 100755 --- a/podman-peerjs/ci_build-images.sh +++ b/podman-peerjs/ci_build-images.sh @@ -18,6 +18,8 @@ if ! podman image exists ${upstream_images}:${version}; then --label org.opencontainers.image.title='PeerServer' \ --label org.opencontainers.image.url='https://peerjs.com' \ -t ${upstream_images}:${version} ${buildfolder}/ || retval=false + podman image prune -a -f --filter dangling=true + podman image prune -a -f --filter intermediate=true podman image rm -f $(podman image list -a -q -- docker.io/library/node) rm -rf ${buildfolder} eval "$retval" diff --git a/podman-privatebin/ci_build-images.sh b/podman-privatebin/ci_build-images.sh index 6274d21..a5b22ca 100755 --- a/podman-privatebin/ci_build-images.sh +++ b/podman-privatebin/ci_build-images.sh @@ -7,12 +7,19 @@ source "${ABSDIR}"/vars.sh ensure_pwd_is_scriptdir ensure_not_root +buildfolder=/tmp/privatebin-$$ + if ! podman image exists ${privatebin_image}:${privatebin_version}; then - if git clone -b ${privatebin_version} --depth=1 https://github.com/PrivateBin/docker-nginx-fpm-alpine ; then - sed -i "s#mv cfg lib tpl vendor /srv#mv cfg lib tpl vendor /srv \&\& sed -i \\'/Content-Security-Policy\\\|X-XSS-Protection\\\|X-Frame-Options\\\|X-Content-Type-Options/d\\' /srv/lib/Controller.php#" docker-nginx-fpm-alpine/Dockerfile && - podman image build -t "${privatebin_image}":"${privatebin_version}" docker-nginx-fpm-alpine || retval=false + if git clone -b ${privatebin_version} --depth=1 https://github.com/PrivateBin/docker-nginx-fpm-alpine ${buildfolder} ; then + sed -i "s#mv cfg lib tpl vendor /srv#mv cfg lib tpl vendor /srv \&\& sed -i \\'/Content-Security-Policy\\\|X-XSS-Protection\\\|X-Frame-Options\\\|X-Content-Type-Options/d\\' /srv/lib/Controller.php#" ${buildfolder}/docker-nginx-fpm-alpine/Dockerfile && + podman image build \ + -t "${privatebin_image}":"${privatebin_version}" \ + ${buildfolder}/docker-nginx-fpm-alpine || retval=false + podman image prune -a -f --filter dangling=true + podman image prune -a -f --filter intermediate=true + podman image rm -f $(podman image list -a -q -- docker.io/library/alpine) fi - rm -rf docker-nginx-fpm-alpine + rm -rf ${buildfolder} eval "$retval" else echo "Image ${privatebin_image}:${privatebin_version} already built" diff --git a/podman-seafile/ci_build-images.sh b/podman-seafile/ci_build-images.sh index 05e597a..df0d9a5 100755 --- a/podman-seafile/ci_build-images.sh +++ b/podman-seafile/ci_build-images.sh @@ -18,9 +18,12 @@ if ! podman image exists ${seafile_image}:${seafile_release}; then sed_in_place " -i https://pypi.tuna.tsinghua.edu.cn/simple/" " " ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile && sed_in_place 'wget https://seafile-downloads.oss-cn-shanghai.aliyuncs.com' 'wget -q https://download.seadrive.org' ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile && sed_in_place 'tar -zxvf' 'tar -zxf' ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile && - podman image build -t ${seafile_image}:${seafile_release} \ - -f ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile \ - ${buildfolder} || retval=false + podman image build \ + -t ${seafile_image}:${seafile_release} \ + -f ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile \ + ${buildfolder} || retval=false + podman image prune -a -f --filter dangling=true + podman image prune -a -f --filter intermediate=true podman image rm -f $(podman image list -a -q -- phusion/baseimage) fi rm -rf ${buildfolder} diff --git a/podman-vaultwarden/ci_build-images.sh b/podman-vaultwarden/ci_build-images.sh index f5d2c16..4ba34d8 100755 --- a/podman-vaultwarden/ci_build-images.sh +++ b/podman-vaultwarden/ci_build-images.sh @@ -11,19 +11,19 @@ buildfolder=/tmp/vaultwarden-$$ if ! podman image exists ${service_image}:${service_version}; then mkdir ${buildfolder} && - if git clone --depth=1 --branch=${service_version} https://github.com/dani-garcia/vaultwarden.git ${buildfolder}/ ; then - TMPDIR=${HOME} podman image build \ - -t ${service_image}:${service_version} \ - --build-arg DB=postgresql,enable_mimalloc \ - -f ${buildfolder}/docker/amd64/Dockerfile \ - ${buildfolder} || retval=false - fi + if git clone --depth=1 --branch=${service_version} https://github.com/dani-garcia/vaultwarden.git ${buildfolder}/ ; then + TMPDIR=${HOME} podman image build \ + -t ${service_image}:${service_version} \ + --build-arg DB=postgresql,enable_mimalloc \ + -f ${buildfolder}/docker/amd64/Dockerfile \ + ${buildfolder} || retval=false + podman image prune -a -f --filter dangling=true + podman image prune -a -f --filter intermediate=true + podman image rm -f $(podman image list -a -q -- vaultwarden/web-vault) + podman image rm -f $(podman image list -a -q -- docker.io/blackdex/rust-musl) + podman image rm -f $(podman image list -a -q -- docker.io/library/alpine) + fi rm -rf ${buildfolder} - podman image prune -a -f --filter dangling=true - podman image prune -a -f --filter intermediate=true - podman image rm -f $(podman image list -a -q -- vaultwarden/web-vault) - podman image rm -f $(podman image list -a -q -- docker.io/blackdex/rust-musl) - podman image rm -f $(podman image list -a -q -- docker.io/library/alpine) eval "$retval" else echo "Image ${service_image}:${service_version} already built"