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

33 lines
1.2 KiB
Bash
Raw Normal View History

2022-11-26 22:00:34 +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-26 22:00:34 +00:00
ensure_pwd_is_scriptdir
ensure_not_root
buildfolder=/tmp/vaultwarden-$$
if ! podman image exists ${vaultwarden_image}:${vaultwarden_version}; then
mkdir ${buildfolder} &&
2023-07-29 07:14:59 +00:00
if git clone --depth=1 --branch=${vaultwarden_version} https://github.com/dani-garcia/vaultwarden.git ${buildfolder}/ ; then
TMPDIR=${HOME} podman image build \
-t ${vaultwarden_image}:${vaultwarden_version} \
2023-08-10 20:37:44 +00:00
--build-arg DB=postgresql,enable_mimalloc \
-f ${buildfolder}/docker/amd64/Dockerfile.alpine \
${buildfolder} || retval=false
fi
2022-11-26 22:00:34 +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 -- 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 -- dockerio/library/alpine)"
eval "$retval"
2022-11-26 22:00:34 +00:00
else
echo "Image ${vaultwarden_image}:${vaultwarden_version} already built"
fi &&
2022-11-26 22:00:34 +00:00
oci_push_to_registry ${vaultwarden_image}:${vaultwarden_version}