script ci_build-images : shellcheck

This commit is contained in:
Gitouche 2023-07-29 09:14:59 +02:00
parent 4baf3641ad
commit 86bf4f9e7a
9 changed files with 66 additions and 64 deletions

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
@ -11,18 +11,18 @@ buildfolder=/tmp/gitea-$$
if ! podman image exists ${gitea_image}:${gitea_version}; then
mkdir ${buildfolder} &&
git clone -b v${gitea_version} --depth=1 https://codeberg.org/forgejo/forgejo/ ${buildfolder} && {
if git clone -b v${gitea_version} --depth=1 https://codeberg.org/forgejo/forgejo/ ${buildfolder} ; then
TMPDIR=${HOME} podman image build \
--label org.opencontainers.image.version="${gitea_version}" \
-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)
}
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)"
fi
rm -rf ${buildfolder}
eval $retval
eval "$retval"
else
echo "Image ${gitea_image}:${gitea_version} already built"
fi &&

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
@ -11,14 +11,14 @@ buildfolder=/tmp/hedgedoc-$$
if ! podman image exists ${hedgedoc_image}:${hedgedoc_version}; then
mkdir ${buildfolder} &&
git clone --depth=1 https://github.com/hedgedoc/container ${buildfolder}/ && {
if git clone --depth=1 https://github.com/hedgedoc/container ${buildfolder}/ ; then
podman image build -t ${hedgedoc_image}:${hedgedoc_version} -f ${buildfolder}/alpine/Dockerfile ${buildfolder}/
} || retval=false
fi || 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
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 &&

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
@ -13,41 +13,42 @@ build_base() {
podman image pull docker.io/library/debian:bullseye-slim
if ! podman image exists localhost/jitsi/base:${version}; then
podman image build -t localhost/jitsi/base:${version} ${buildfolder}/base/ &&
podman image tag localhost/jitsi/base:${version} localhost/jitsi/base:latest || exit -1
podman image tag localhost/jitsi/base:${version} localhost/jitsi/base:latest || exit 255
fi
if ! podman image exists localhost/jitsi/base-java:${version}; then
podman image build -t localhost/jitsi/base-java:${version} ${buildfolder}/base-java &&
podman image tag localhost/jitsi/base-java:${version} localhost/jitsi/base-java:latest || exit -1
podman image tag localhost/jitsi/base-java:${version} localhost/jitsi/base-java:latest || exit 255
fi
base_cleanup=true
}
mkdir ${buildfolder} &&
curl -sSfL -- "https://github.com/jitsi/docker-jitsi-meet/archive/refs/tags/${version}.tar.gz" | tar xz --strip-components 1 -C ${buildfolder}/ && {
if curl -sSfL -- "https://github.com/jitsi/docker-jitsi-meet/archive/refs/tags/${version}.tar.gz" | tar xz --strip-components 1 -C ${buildfolder}/ ; then
if ! podman image exists git.garbaye.fr/garbaye/jitsi-jvb:${version}; then
build_base
podman image build -t git.garbaye.fr/garbaye/jitsi-jvb:${version} ${buildfolder}/jvb/ || exit -1
podman image build -t git.garbaye.fr/garbaye/jitsi-jvb:${version} ${buildfolder}/jvb/ || exit 255
fi
if ! podman image exists git.garbaye.fr/garbaye/jitsi-jicofo:${version}; then
build_base
podman image build -t git.garbaye.fr/garbaye/jitsi-jicofo:${version} ${buildfolder}/jicofo/ || exit -1
podman image build -t git.garbaye.fr/garbaye/jitsi-jicofo:${version} ${buildfolder}/jicofo/ || exit 255
fi
if ! podman image exists git.garbaye.fr/garbaye/jitsi-prosody:${version}; then
build_base
podman image build -t git.garbaye.fr/garbaye/jitsi-prosody:${version} ${buildfolder}/prosody/ || exit -1
podman image build -t git.garbaye.fr/garbaye/jitsi-prosody:${version} ${buildfolder}/prosody/ || exit 255
fi
if ! podman image exists git.garbaye.fr/garbaye/jitsi-web:${version}; then
build_base
podman image build -t git.garbaye.fr/garbaye/jitsi-web:${version} ${buildfolder}/web/ || exit -1
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)
[ ! -z "${dangling_images}" ] && podman image rm -f ${dangling_images}
if [ ! -z ${base_cleanup} ] ; then
[ -n "${dangling_images}" ] && podman image rm -f "${dangling_images}"
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
fi
} ; rm -rf ${buildfolder}
fi
rm -rf ${buildfolder}
for image in ${upstream_images}; do
oci_push_to_registry ${image}:${version}
oci_push_to_registry "${image}":${version}
done

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
@ -11,8 +11,8 @@ 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
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)
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)"
else
echo "Image ${ntfy_image}:${ntfy_version} already built"
fi

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
@ -18,9 +18,9 @@ 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 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}
eval $retval
eval "$retval"
else
echo "Image ${upstream_images}:${version} already built"
fi &&

View file

@ -1,18 +1,19 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
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 &&
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
fi
rm -rf docker-nginx-fpm-alpine
eval $retval
eval "$retval"
else
echo "Image ${privatebin_image}:${privatebin_version} already built"
fi &&

View file

@ -9,17 +9,17 @@ ensure_not_root
buildfolder=/tmp/seafile-$$
if ! podman image exists "${seafile_image}":"${seafile_release}"; then
if ! podman image exists ${seafile_image}:${seafile_release}; then
mkdir ${buildfolder} &&
if git clone --depth=1 https://github.com/haiwen/seafile-docker.git ${buildfolder}/ ; then
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 &&
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 \
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 &&
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 rm -f "$(podman image list -a -q -- phusion/baseimage)"
fi
@ -29,4 +29,4 @@ else
echo "Image ${seafile_image}:${seafile_release} already built"
fi &&
oci_push_to_registry "${seafile_image}":"${seafile_release}"
oci_push_to_registry ${seafile_image}:${seafile_release}

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
@ -11,19 +11,19 @@ buildfolder=/tmp/vaultwarden-$$
if ! podman image exists ${vaultwarden_image}:${vaultwarden_version}; then
mkdir ${buildfolder} &&
git clone --depth=1 --branch=${vaultwarden_version} https://github.com/dani-garcia/vaultwarden.git ${buildfolder}/ && {
sed_in_place "^FROM vaultwarden/web-vault" "FROM docker.io/vaultwarden/web-vault" ${buildfolder}/docker/amd64/Dockerfile.alpine
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
if git clone --depth=1 --branch=${vaultwarden_version} https://github.com/dani-garcia/vaultwarden.git ${buildfolder}/ ; then
sed_in_place "^FROM vaultwarden/web-vault" "FROM docker.io/vaultwarden/web-vault" ${buildfolder}/docker/amd64/Dockerfile.alpine &&
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
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 -- dockerio/library/alpine)
eval $retval
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 &&