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-$$
|
|
|
|
|
2023-08-18 16:14:05 +00:00
|
|
|
if ! podman image exists ${service_image}:${service_version}; then
|
2022-11-26 22:00:34 +00:00
|
|
|
mkdir ${buildfolder} &&
|
2023-08-18 16:14:05 +00:00
|
|
|
if git clone --depth=1 --branch=${service_version} https://github.com/dani-garcia/vaultwarden.git ${buildfolder}/ ; then
|
2023-08-10 20:26:20 +00:00
|
|
|
TMPDIR=${HOME} podman image build \
|
2023-08-18 16:14:05 +00:00
|
|
|
-t ${service_image}:${service_version} \
|
2023-08-10 20:37:44 +00:00
|
|
|
--build-arg DB=postgresql,enable_mimalloc \
|
2023-10-17 11:09:39 +00:00
|
|
|
-f ${buildfolder}/docker/amd64/Dockerfile \
|
2023-08-10 20:26:20 +00:00
|
|
|
${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)"
|
2023-08-18 16:42:30 +00:00
|
|
|
podman image rm -f "$(podman image list -a -q -- docker.io/library/alpine)"
|
2023-07-29 07:14:59 +00:00
|
|
|
eval "$retval"
|
2022-11-26 22:00:34 +00:00
|
|
|
else
|
2023-08-18 16:14:05 +00:00
|
|
|
echo "Image ${service_image}:${service_version} already built"
|
2023-07-28 21:08:44 +00:00
|
|
|
fi &&
|
2022-11-26 22:00:34 +00:00
|
|
|
|
2023-08-18 16:42:30 +00:00
|
|
|
oci_push_to_registry "${service_image}":"${service_version}"
|