2022-03-04 22:55:57 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
2023-07-29 06:53:07 +00:00
|
|
|
source "${ABSDIR}"/../functions.sh
|
|
|
|
source "${ABSDIR}"/vars.sh
|
2022-03-04 22:55:57 +00:00
|
|
|
|
|
|
|
ensure_pwd_is_scriptdir
|
|
|
|
ensure_not_root
|
|
|
|
|
2022-03-05 09:30:15 +00:00
|
|
|
buildfolder=/tmp/synapse-$$
|
|
|
|
|
2022-05-25 19:22:15 +00:00
|
|
|
if ! podman image exists ${synapse_image}:${synapse_version}; then
|
2022-03-05 09:30:15 +00:00
|
|
|
mkdir ${buildfolder} &&
|
2024-03-30 13:38:05 +00:00
|
|
|
if git clone -b ${synapse_version} --depth=1 https://github.com/element-hq/synapse/ ${buildfolder} ; then
|
2023-10-21 14:39:11 +00:00
|
|
|
rm -rf "${HOME}/buildah-cache-${UID}"
|
2023-10-28 15:41:15 +00:00
|
|
|
TMPDIR=${HOME} podman image build \
|
|
|
|
-t ${synapse_image}:${synapse_version} \
|
|
|
|
-f ${buildfolder}/docker/Dockerfile \
|
|
|
|
${buildfolder}/ || retval=false
|
|
|
|
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 -- docker.io/library/python)
|
2023-07-29 06:53:07 +00:00
|
|
|
fi
|
2022-03-05 09:30:15 +00:00
|
|
|
rm -rf ${buildfolder}
|
2023-07-29 06:53:07 +00:00
|
|
|
eval "$retval"
|
2022-08-12 18:34:42 +00:00
|
|
|
else
|
|
|
|
echo "Image ${synapse_image}:${synapse_version} already built"
|
|
|
|
fi &&
|
|
|
|
|
|
|
|
oci_push_to_registry ${synapse_image}:${synapse_version}
|