bette logic in build script : dont try to push to registry on failure

This commit is contained in:
Gitouche 2023-07-28 23:08:44 +02:00
parent 402a178843
commit 36b8d09311
8 changed files with 40 additions and 34 deletions

View file

@ -11,6 +11,6 @@ if ! podman image exists ${framadate_image}:${framadate_version}; then
podman image build -t "${framadate_image}":"${framadate_version}" --build-arg=version="${framadate_version}" container/
else
echo "Image ${framadate_image}:${framadate_version} already built"
fi
fi &&
oci_push_to_registry ${framadate_image}:${framadate_version}

View file

@ -14,15 +14,17 @@ if ! podman image exists ${gitea_image}:${gitea_version}; then
git clone -b v${gitea_version} --depth=1 https://codeberg.org/forgejo/forgejo/ ${buildfolder} && {
TMPDIR=${HOME} podman image build \
--label org.opencontainers.image.version="${gitea_version}" \
-t ${gitea_image}:${gitea_version} -f ${buildfolder}/Dockerfile ${buildfolder}
}
rm -rf ${buildfolder}
-t ${gitea_image}:${gitea_version} \
-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)
podman image rm -f $(podman image list -a -q -- docker.io/library/alpine)
}
rm -rf ${buildfolder}
eval $retval
else
echo "Image ${gitea_image}:${gitea_version} already built"
fi
fi &&
oci_push_to_registry ${gitea_image}:${gitea_version}

View file

@ -13,13 +13,14 @@ if ! podman image exists ${hedgedoc_image}:${hedgedoc_version}; then
mkdir ${buildfolder} &&
git clone --depth=1 https://github.com/hedgedoc/container ${buildfolder}/ && {
podman image build -t ${hedgedoc_image}:${hedgedoc_version} -f ${buildfolder}/alpine/Dockerfile ${buildfolder}/
}
} || retval=false
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"
fi
fi &&
oci_push_to_registry ${hedgedoc_image}:${hedgedoc_version}

View file

@ -23,15 +23,14 @@ if ! podman image exists ${synapse_image}:${synapse_version}; then
--local context=${buildfolder}/ \
--local dockerfile=${buildfolder}/docker/ \
--output type=oci,name="${synapse_image}:${synapse_version}" | \
podman image load &&
podman image load || retval=false
podman container rm --volumes --force buildkitd &&
podman image rm docker.io/moby/buildkit:${buildkitd_version}
} || retval=false
podman image rm --force docker.io/moby/buildkit:${buildkitd_version}
}
rm -rf ${buildfolder}
eval $retval
else
echo "Image ${synapse_image}:${synapse_version} already built"
false
fi &&
oci_push_to_registry ${synapse_image}:${synapse_version}

View file

@ -17,9 +17,10 @@ if ! podman image exists ${upstream_images}:${version}; then
--label org.opencontainers.image.source='https://github.com/peers/peerjs-server' \
--label org.opencontainers.image.title='PeerServer' \
--label org.opencontainers.image.url='https://peerjs.com' \
-t ${upstream_images}:${version} ${buildfolder}/ &&
podman image rm -f $(podman image list -a -q -- docker.io/library/node) &&
-t ${upstream_images}:${version} ${buildfolder}/ || retval=false
podman image rm -f $(podman image list -a -q -- docker.io/library/node)
rm -rf ${buildfolder}
eval $retval
else
echo "Image ${upstream_images}:${version} already built"
fi &&

View file

@ -10,10 +10,11 @@ ensure_not_root
if ! podman image exists ${privatebin_image}:${privatebin_version}; then
git clone -b ${privatebin_version} --depth=1 https://github.com/PrivateBin/docker-nginx-fpm-alpine &&
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 &&
podman image build -t "${privatebin_image}":"${privatebin_version}" docker-nginx-fpm-alpine || retval=false
rm -rf docker-nginx-fpm-alpine
eval $retval
else
echo "Image ${privatebin_image}:${privatebin_version} already built"
fi
fi &&
oci_push_to_registry ${privatebin_image}:${privatebin_version}

View file

@ -11,7 +11,7 @@ buildfolder=/tmp/seafile-$$
if ! podman image exists ${seafile_image}:${seafile_release}; then
mkdir ${buildfolder} &&
git clone --depth=1 https://github.com/haiwen/seafile-docker.git ${buildfolder}/ &&
git clone --depth=1 https://github.com/haiwen/seafile-docker.git ${buildfolder}/ && {
sed_in_place "^FROM phusion" "FROM docker.io/phusion" ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
sed_in_place "SEAFILE_VERSION=" "SEAFILE_VERSION=${seafile_release}" ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
sed_in_place "pip -i https://pypi.tuna.tsinghua.edu.cn/simple/" "pip" ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
@ -20,11 +20,12 @@ if ! podman image exists ${seafile_image}:${seafile_release}; then
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} &&
podman image rm -f $(podman image list -a -q -- phusion/baseimage)
${buildfolder} || retval=false
podman image rm -f $(podman image list -a -q -- phusion/baseimage) }
rm -rf ${buildfolder}
eval $retval
else
echo "Image ${seafile_image}:${seafile_release} already built"
fi
fi &&
oci_push_to_registry ${seafile_image}:${seafile_release}

View file

@ -16,15 +16,16 @@ if ! podman image exists ${vaultwarden_image}:${vaultwarden_version}; then
sed_in_place "^FROM blackdex/rust-musl" "FROM docker.io/blackdex/rust-musl" ${buildfolder}/docker/amd64/Dockerfile.alpine
sed_in_place "^FROM alpine" "FROM docker.io/library/alpine" ${buildfolder}/docker/amd64/Dockerfile.alpine
TMPDIR=${HOME} podman image build -t ${vaultwarden_image}:${vaultwarden_version} -f ${buildfolder}/docker/amd64/Dockerfile.alpine ${buildfolder}
}
} || retval=false
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 -- dockerio/library/alpine)
eval $retval
else
echo "Image ${vaultwarden_image}:${vaultwarden_version} already built"
fi
fi &&
oci_push_to_registry ${vaultwarden_image}:${vaultwarden_version}