services-garbaye/podman-matrix/zz_build-images.sh

27 lines
946 B
Bash
Raw Normal View History

#!/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-$$
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 run -d --name buildkitd --privileged docker.io/moby/buildkit:latest &&
my_buildctl --addr=podman-container://buildkitd build \
2022-03-05 08:40:20 +00:00
--frontend dockerfile.v0 \
--local context=${buildfolder}/ \
--local dockerfile=${buildfolder}/docker/ \
--output type=oci,name="${synapse_image}:${synapse_version}" | \
podman load &&
podman rm --force buildkitd &&
2022-03-05 22:43:34 +00:00
podman rmi docker.io/moby/buildkit:latest
}
rm -rf ${buildfolder}
fi