services-garbaye/podman-vaultwarden/ci_build-images.sh
2023-08-18 18:42:30 +02:00

33 lines
1.2 KiB
Bash
Executable file

#!/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/vaultwarden-$$
if ! podman image exists ${service_image}:${service_version}; then
mkdir ${buildfolder} &&
if git clone --depth=1 --branch=${service_version} https://github.com/dani-garcia/vaultwarden.git ${buildfolder}/ ; then
TMPDIR=${HOME} podman image build \
-t ${service_image}:${service_version} \
--build-arg DB=postgresql,enable_mimalloc \
-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 -- docker.io/library/alpine)"
eval "$retval"
else
echo "Image ${service_image}:${service_version} already built"
fi &&
oci_push_to_registry "${service_image}":"${service_version}"