services-garbaye/podman-peerjs/ci_build-images.sh

31 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} &&
git clone -b v${version} --depth=1 https://github.com/peers/peerjs-server/ ${buildfolder} &&
TMPDIR=${HOME} 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 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/node)
rm -rf ${buildfolder}
eval "$retval"
else
echo "Image ${upstream_images}:${version} already built"
fi &&
oci_push_to_registry ${upstream_images}:${version}