services-garbaye/podman-privatebin/ci_build-images.sh

29 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
2023-07-29 07:14:59 +00:00
source "${ABSDIR}"/../functions.sh
source "${ABSDIR}"/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
2023-10-28 15:41:15 +00:00
buildfolder=/tmp/privatebin-$$
if ! podman image exists ${privatebin_image}:${privatebin_version}; then
2023-10-28 15:41:15 +00:00
if git clone -b ${privatebin_version} --depth=1 https://github.com/PrivateBin/docker-nginx-fpm-alpine ${buildfolder} ; then
2023-10-28 17:10:34 +00:00
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}/Dockerfile &&
2023-10-28 15:41:15 +00:00
podman image build \
-t "${privatebin_image}":"${privatebin_version}" \
2023-10-28 17:10:34 +00:00
${buildfolder} || retval=false
2023-10-28 15:41:15 +00:00
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)
2023-07-29 07:14:59 +00:00
fi
2023-10-28 15:41:15 +00:00
rm -rf ${buildfolder}
2023-07-29 07:14:59 +00:00
eval "$retval"
else
echo "Image ${privatebin_image}:${privatebin_version} already built"
fi &&
oci_push_to_registry ${privatebin_image}:${privatebin_version}