build image script : uniformisation

This commit is contained in:
Gitouche 2023-10-28 17:41:15 +02:00
parent 8c27efdba9
commit 133e178d05
10 changed files with 63 additions and 33 deletions

View file

@ -8,7 +8,14 @@ ensure_pwd_is_scriptdir
ensure_not_root ensure_not_root
if ! podman image exists ${framadate_image}:${framadate_version}; then 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 else
echo "Image ${framadate_image}:${framadate_version} already built" echo "Image ${framadate_image}:${framadate_version} already built"
fi && fi &&

View file

@ -16,7 +16,8 @@ if ! podman image exists ${gitea_image}:${gitea_version}; then
TMPDIR=${HOME} podman image build \ TMPDIR=${HOME} podman image build \
--label org.opencontainers.image.version="${gitea_version}" \ --label org.opencontainers.image.version="${gitea_version}" \
-t ${gitea_image}:${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 dangling=true
podman image prune -a -f --filter intermediate=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/golang)

View file

@ -12,12 +12,16 @@ buildfolder=/tmp/hedgedoc-$$
if ! podman image exists ${hedgedoc_image}:${hedgedoc_version}; then if ! podman image exists ${hedgedoc_image}:${hedgedoc_version}; then
mkdir ${buildfolder} && mkdir ${buildfolder} &&
if git clone --depth=1 https://github.com/hedgedoc/container ${buildfolder}/ ; then 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}/ rm -rf "${HOME}/buildah-cache-${UID}"
fi || retval=false TMPDIR=${HOME} podman image build \
rm -rf ${buildfolder} -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 dangling=true
podman image prune -a -f --filter intermediate=true podman image prune -a -f --filter intermediate=true
podman image rm -f $(podman image list -a -q -- docker.io/library/node) podman image rm -f $(podman image list -a -q -- docker.io/library/node)
fi
rm -rf ${buildfolder}
eval "$retval" eval "$retval"
else else
echo "Image ${hedgedoc_image}:${hedgedoc_version} already built" echo "Image ${hedgedoc_image}:${hedgedoc_version} already built"

View file

@ -40,8 +40,8 @@ if curl -sSfL -- "https://github.com/jitsi/docker-jitsi-meet/archive/refs/tags/$
build_base build_base
podman image build -t git.garbaye.fr/garbaye/jitsi-web:${version} ${buildfolder}/web/ || exit 255 podman image build -t git.garbaye.fr/garbaye/jitsi-web:${version} ${buildfolder}/web/ || exit 255
fi fi
dangling_images=$(podman image list -f "dangling=true" -q) podman image prune -a -f --filter dangling=true
[ -n "${dangling_images}" ] && podman image rm -f "${dangling_images}" podman image prune -a -f --filter intermediate=true
if [ -n "${base_cleanup}" ] ; then if [ -n "${base_cleanup}" ] ; then
podman image rm localhost/jitsi/base-java:${version} localhost/jitsi/base-java:latest podman image rm localhost/jitsi/base-java:${version} localhost/jitsi/base-java:latest
podman image rm localhost/jitsi/base:${version} localhost/jitsi/base:latest podman image rm localhost/jitsi/base:${version} localhost/jitsi/base:latest

View file

@ -13,8 +13,13 @@ if ! podman image exists ${synapse_image}:${synapse_version}; then
mkdir ${buildfolder} && 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 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}" rm -rf "${HOME}/buildah-cache-${UID}"
TMPDIR=${HOME} podman image build -t ${synapse_image}:${synapse_version} -f ${buildfolder}/docker/Dockerfile ${buildfolder}/ && TMPDIR=${HOME} podman image build \
podman image prune -f -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 fi
rm -rf ${buildfolder} rm -rf ${buildfolder}
eval "$retval" eval "$retval"

View file

@ -8,13 +8,14 @@ ensure_pwd_is_scriptdir
ensure_not_root ensure_not_root
if ! podman image exists ${ntfy_image}:${ntfy_version}; then 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 dangling=true
podman image prune -a -f --filter intermediate=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/golang)
podman image rm -f $(podman image list -a -q -- docker.io/library/alpine) podman image rm -f $(podman image list -a -q -- docker.io/library/alpine)
eval "$retval"
else else
echo "Image ${ntfy_image}:${ntfy_version} already built" echo "Image ${ntfy_image}:${ntfy_version} already built"
fi fi &&
oci_push_to_registry ${ntfy_image}:${ntfy_version} oci_push_to_registry ${ntfy_image}:${ntfy_version}

View file

@ -18,6 +18,8 @@ if ! podman image exists ${upstream_images}:${version}; then
--label org.opencontainers.image.title='PeerServer' \ --label org.opencontainers.image.title='PeerServer' \
--label org.opencontainers.image.url='https://peerjs.com' \ --label org.opencontainers.image.url='https://peerjs.com' \
-t ${upstream_images}:${version} ${buildfolder}/ || retval=false -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) podman image rm -f $(podman image list -a -q -- docker.io/library/node)
rm -rf ${buildfolder} rm -rf ${buildfolder}
eval "$retval" eval "$retval"

View file

@ -7,12 +7,19 @@ source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir ensure_pwd_is_scriptdir
ensure_not_root ensure_not_root
buildfolder=/tmp/privatebin-$$
if ! podman image exists ${privatebin_image}:${privatebin_version}; then 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 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#" docker-nginx-fpm-alpine/Dockerfile && 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}" docker-nginx-fpm-alpine || retval=false 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 fi
rm -rf docker-nginx-fpm-alpine rm -rf ${buildfolder}
eval "$retval" eval "$retval"
else else
echo "Image ${privatebin_image}:${privatebin_version} already built" echo "Image ${privatebin_image}:${privatebin_version} already built"

View file

@ -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 " -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 '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 && sed_in_place 'tar -zxvf' 'tar -zxf' ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile &&
podman image build -t ${seafile_image}:${seafile_release} \ podman image build \
-t ${seafile_image}:${seafile_release} \
-f ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile \ -f ${buildfolder}/image/seafile_${seafile_release%.*}/Dockerfile \
${buildfolder} || retval=false ${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) podman image rm -f $(podman image list -a -q -- phusion/baseimage)
fi fi
rm -rf ${buildfolder} rm -rf ${buildfolder}

View file

@ -17,13 +17,13 @@ if ! podman image exists ${service_image}:${service_version}; then
--build-arg DB=postgresql,enable_mimalloc \ --build-arg DB=postgresql,enable_mimalloc \
-f ${buildfolder}/docker/amd64/Dockerfile \ -f ${buildfolder}/docker/amd64/Dockerfile \
${buildfolder} || retval=false ${buildfolder} || retval=false
fi
rm -rf ${buildfolder}
podman image prune -a -f --filter dangling=true podman image prune -a -f --filter dangling=true
podman image prune -a -f --filter intermediate=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 -- 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/blackdex/rust-musl)
podman image rm -f $(podman image list -a -q -- docker.io/library/alpine) podman image rm -f $(podman image list -a -q -- docker.io/library/alpine)
fi
rm -rf ${buildfolder}
eval "$retval" eval "$retval"
else else
echo "Image ${service_image}:${service_version} already built" echo "Image ${service_image}:${service_version} already built"