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

29 lines
1.1 KiB
Bash
Raw Normal View History

2022-11-20 11:05:33 +00:00
#!/usr/bin/env bash
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
source ${ABSDIR}/../functions.sh
source ${ABSDIR}/vars.sh
ensure_pwd_is_scriptdir
ensure_not_root
buildfolder=/tmp/hedgedoc-$$
if ! podman image exists ${hedgedoc_image}:${hedgedoc_version}; then
mkdir ${buildfolder} &&
2022-11-20 12:00:57 +00:00
git clone --depth=1 https://github.com/hedgedoc/container ${buildfolder}/ && {
2022-11-20 11:05:33 +00:00
#sed_in_place "^FROM golang" "FROM docker.io/library/golang" ${buildfolder}/Dockerfile
#sed_in_place "^FROM alpine" "FROM docker.io/library/alpine" ${buildfolder}/Dockerfile
2022-11-20 12:00:57 +00:00
TMPDIR=${HOME} podman image build -t ${hedgedoc_image}:${hedgedoc_version} --build-arg VERSION=${hedgedoc_version/%-alpine/} -f ${buildfolder}/alpine/Dockerfile ${buildfolder}
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
#podman image rm -f $(podman images -a -q -- docker.io/library/golang)
#podman image rm -f $(podman images -a -q -- docker.io/library/alpine)
else
echo "Image ${hedgedoc_image}:${hedgedoc_version} already built"
fi
oci_push_to_registry ${hedgedoc_image}:${hedgedoc_version}