diff --git a/.woodpecker.yml b/.woodpecker.yml index 983fbd7..893d0a2 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -4,7 +4,7 @@ pipeline: settings: registry: registry.nulo.in username: sutty - repo: registry.nulo.in/sutty/CHANGEME + repo: registry.nulo.in/sutty/matterbridge tags: - ${ALPINE_VERSION} - latest diff --git a/Dockerfile b/Dockerfile index d93a8d9..53b5b64 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,3 +2,9 @@ ARG ALPINE_VERSION=3.13.6 ARG BASE_IMAGE=sutty/monit FROM ${BASE_IMAGE}:${ALPINE_VERSION} MAINTAINER "f " + +RUN apk add --no-cache matterbridge daemonize +COPY ./monit.conf /etc/monit.d/matterbridge.conf +COPY ./matterbridged.sh /usr/local/bin/matterbridged + +VOLUME /srv/matterbridge diff --git a/matterbridged.sh b/matterbridged.sh new file mode 100755 index 0000000..5b099c1 --- /dev/null +++ b/matterbridged.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -e + +pid=/run/matterbridge.pid +log=/tmp/matterbridge.log +cnf=/etc/matterbridge/matterbridge.toml + +case $1 in + start) + daemonize -a -e ${log} -o ${log} -p ${pid} -l ${pid} /usr/bin/matterbridge -conf ${cnf} + ;; + stop) + test -f ${pid} || exit 0 + + cat ${pid} | xargs -r kill + + rm -f ${pid} + ;; +esac diff --git a/monit.conf b/monit.conf new file mode 100644 index 0000000..0cf5a81 --- /dev/null +++ b/monit.conf @@ -0,0 +1,3 @@ +check process with pidfile /run/matterbridge.pid + start program = "/usr/local/bin/matterbridged start" + stop program = "/usr/local/bin/matterbridged stop"