31 lines
1.4 KiB
Bash
Executable file
31 lines
1.4 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 ${vaultwarden_image}:${vaultwarden_version}; then
|
|
mkdir ${buildfolder} &&
|
|
git clone --depth=1 --branch=${vaultwarden_version} https://github.com/dani-garcia/vaultwarden.git ${buildfolder}/ && {
|
|
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}
|
|
}
|
|
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 -- dockerio/library/alpine)
|
|
else
|
|
echo "Image ${vaultwarden_image}:${vaultwarden_version} already built"
|
|
fi
|
|
|
|
oci_push_to_registry ${vaultwarden_image}:${vaultwarden_version}
|