38 lines
1.4 KiB
Bash
Executable file
38 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/synapse-$$
|
|
|
|
buildkitd_version='latest'
|
|
buildkitd_args='--oci-worker-snapshotter=native' # needed as of v0.12.0
|
|
|
|
if ! podman image exists ${synapse_image}:${synapse_version}; then
|
|
mkdir ${buildfolder} &&
|
|
curl -sSfL -- "https://github.com/matrix-org/synapse/archive/refs/tags/${synapse_version}.tar.gz" | \tar xz --strip-components 1 -C ${buildfolder}/ && {
|
|
podman image pull docker.io/moby/buildkit:${buildkitd_version}
|
|
podman container run -d --name buildkitd --privileged docker.io/moby/buildkit:${buildkitd_version} ${buildkitd_args} &&
|
|
sleep 3
|
|
my_buildctl --addr=podman-container://buildkitd build \
|
|
--frontend dockerfile.v0 \
|
|
--local context=${buildfolder}/ \
|
|
--local dockerfile=${buildfolder}/docker/ \
|
|
--output type=oci,name="${synapse_image}:${synapse_version}" | \
|
|
podman image load &&
|
|
podman container rm --volumes --force buildkitd &&
|
|
podman image rm docker.io/moby/buildkit:${buildkitd_version}
|
|
} || retval=false
|
|
rm -rf ${buildfolder}
|
|
eval $retval
|
|
else
|
|
echo "Image ${synapse_image}:${synapse_version} already built"
|
|
false
|
|
fi &&
|
|
|
|
oci_push_to_registry ${synapse_image}:${synapse_version}
|