services-garbaye/podman-peerjs/ci_build-images.sh
2023-07-29 09:14:59 +02:00

29 lines
1.2 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/peerjs-server-$$
if ! podman image exists ${upstream_images}:${version}; then
mkdir ${buildfolder} &&
curl -sSfL -- "https://github.com/peers/peerjs-server/archive/refs/tags/v${version}.tar.gz" | \tar xz --strip-components 1 -C ${buildfolder}/ &&
podman image build \
--label org.opencontainers.image.description='PeerServer helps establishing connections between PeerJS clients. Data is not proxied through the server.' \
--label org.opencontainers.image.source='https://github.com/peers/peerjs-server' \
--label org.opencontainers.image.title='PeerServer' \
--label org.opencontainers.image.url='https://peerjs.com' \
-t ${upstream_images}:${version} ${buildfolder}/ || retval=false
podman image rm -f "$(podman image list -a -q -- docker.io/library/node)"
rm -rf ${buildfolder}
eval "$retval"
else
echo "Image ${upstream_images}:${version} already built"
fi &&
oci_push_to_registry ${upstream_images}:${version}