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
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 &&

View File

@ -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)

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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}

View File

@ -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"

View File

@ -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"

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 '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}

View File

@ -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"