init build

This commit is contained in:
KsmoinO 2022-11-20 12:05:33 +01:00
parent 9abdce504e
commit 93e75cd509

View file

@ -0,0 +1,28 @@
#!/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} &&
curl -sSfLo ${buildfolder}/Dockerfile -- "https://github.com/hedgedoc/container/raw/master/alpine/Dockerfile" ${buildfolder}/ && {
#sed_in_place "^FROM golang" "FROM docker.io/library/golang" ${buildfolder}/Dockerfile
#sed_in_place "^FROM alpine" "FROM docker.io/library/alpine" ${buildfolder}/Dockerfile
TMPDIR=${HOME} podman image build -t ${hedgedoc_image}:${hedgedoc_version} -f ${buildfolder}/Dockerfile ${buildfolder}
}
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}