2022-11-26 22:00:34 +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/vaultwarden-$$
|
|
|
|
|
|
|
|
if ! podman image exists ${vaultwarden_image}:${vaultwarden_version}; then
|
|
|
|
mkdir ${buildfolder} &&
|
|
|
|
git clone --depth=1 --branch=${vaultwarden_version} https://github.com/dani-garcia/vaultwarden.git ${buildfolder}/ && {
|
2022-11-26 22:18:26 +00:00
|
|
|
sed_in_place "^FROM vaultwarden/web-vault" "FROM docker.io/vaultwarden/web-vault" ${buildfolder}/docker/amd64/Dockerfile.alpine
|
|
|
|
sed_in_place "^FROM blackdex/rust-musl" "FROM docker.io/blackdex/rust-musl" ${buildfolder}/docker/amd64/Dockerfile.alpine
|
|
|
|
sed_in_place "^FROM alpine" "FROM docker.io/library/alpine" ${buildfolder}/docker/amd64/Dockerfile.alpine
|
|
|
|
TMPDIR=${HOME} podman image build -t ${vaultwarden_image}:${vaultwarden_version} -f ${buildfolder}/docker/amd64/Dockerfile.alpine ${buildfolder}
|
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-04-21 11:53:55 +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)
|
2022-11-26 22:00:34 +00:00
|
|
|
else
|
|
|
|
echo "Image ${vaultwarden_image}:${vaultwarden_version} already built"
|
|
|
|
fi
|
|
|
|
|
|
|
|
oci_push_to_registry ${vaultwarden_image}:${vaultwarden_version}
|