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

27 lines
906 B
Bash
Raw Normal View History

2022-11-20 11:05:33 +00:00
#!/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
2022-11-20 11:05:33 +00:00
ensure_pwd_is_scriptdir
ensure_not_root
buildfolder=/tmp/hedgedoc-$$
if ! podman image exists ${hedgedoc_image}:${hedgedoc_version}; then
mkdir ${buildfolder} &&
2023-07-29 07:14:59 +00:00
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}/
2023-07-29 07:14:59 +00:00
fi || retval=false
2022-11-20 11:05:33 +00:00
rm -rf ${buildfolder}
podman image prune -a -f --filter dangling=true
podman image prune -a -f --filter intermediate=true
2023-07-29 07:14:59 +00:00
podman image rm -f "$(podman image list -a -q -- docker.io/library/node)"
eval "$retval"
2022-11-20 11:05:33 +00:00
else
echo "Image ${hedgedoc_image}:${hedgedoc_version} already built"
fi &&
2022-11-20 11:05:33 +00:00
oci_push_to_registry ${hedgedoc_image}:${hedgedoc_version}