2022-03-05 09:26:09 +00:00
#!/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
2022-03-05 09:30:15 +00:00
mkdir ${ buildfolder } &&
2022-03-05 09:26:09 +00:00
curl -sSfL -- " https://github.com/peers/peerjs-server/archive/refs/tags/v ${ version } .tar.gz " | \t ar xz --strip-components 1 -C ${ buildfolder } / &&
2022-08-12 17:49:06 +00:00
sed_in_place "^FROM node:alpine" "FROM docker.io/library/node:alpine" ${ buildfolder } /Dockerfile &&
2022-12-13 21:40:46 +00:00
podman 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 } / &&
2022-08-12 17:49:06 +00:00
podman rmi docker.io/library/node:alpine &&
2022-08-12 17:50:11 +00:00
rm -rf ${ buildfolder }
2022-08-12 18:09:34 +00:00
else
echo " Image ${ upstream_images } : ${ version } already built "
2022-08-12 17:49:06 +00:00
fi &&
2022-08-12 17:42:46 +00:00
2022-08-12 18:24:33 +00:00
oci_push_to_registry ${ upstream_images } :${ version }