peerjs : build your own images!

This commit is contained in:
Gitouche 2022-03-05 10:26:09 +01:00
parent cc9a706181
commit bf8f3f460a
4 changed files with 24 additions and 3 deletions

View file

@ -9,6 +9,8 @@ ensure_not_root
ensure_container_not_exists ${container_name}
source ${ABSDIR}/zz_build-images.sh
podman run --name ${container_name} --user nobody -p ${listen_if}:${listen_port}:9000 -d ${upstream_images}:${version} &&
( podman logs -f peerjs-server 2>&1 & ) | grep -q 'Started PeerServer' &&
podman stop ${container_name} &&

View file

@ -19,8 +19,8 @@ fi
echo Rebuilding container ${container_name} with image ${upstream_imageversion}
# pull first for minimal downtime
podman pull ${upstream_imageversion}
# build first for minimal downtime
source ${ABSDIR}/zz_build-images.sh
${ABSDIR}/40_stop.sh
${ABSDIR}/80_destroy.sh

View file

@ -4,5 +4,5 @@ container_name='peerjs-server'
service_name="container-${container_name}.service"
listen_if="${GARBAYE_PEERJS_ENV_LISTENIF:-127.0.0.1}"
listen_port="${GARBAYE_PEERJS_ENV_LISTENPORT:-8081}"
upstream_images='docker.io/peerjs/peerjs-server'
upstream_images='localhost/peerjs/peerjs-server'
version='0.6.1'

View file

@ -0,0 +1,19 @@
#!/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 -p ${buildfolder} &&
curl -sSfL -- "https://github.com/peers/peerjs-server/archive/refs/tags/v${version}.tar.gz" | \tar xz --strip-components 1 -C ${buildfolder}/ &&
sed_in_place "^FROM node:alpine" "FROM docker.io/library/node:alpine" ${buildfolder}/Dockerfile
podman build -t ${upstream_images}:${version} ${buildfolder}/
podman rmi docker.io/library/node:alpine
rm -rf ${buildfolder}
fi