From 87eb526eb5f596471777148d0ac22cc55b1c0c88 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sun, 30 Jan 2022 18:34:49 +0100 Subject: [PATCH] Add an entrypoint to configure ssmtp --- Dockerfile | 7 ++++++- entrypoint.sh | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index c66879c..a8fb3d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM alpine RUN apk add --no-cache \ + ca-certificates \ nagios \ nagios-plugins \ nagios-plugins-dig \ @@ -14,8 +15,12 @@ RUN apk add --no-cache \ nagios-plugins-ssh \ nagios-plugins-ssl_validity \ nagios-web \ - nrpe-plugin + nrpe-plugin \ + ssmtp USER nagios +COPY entrypoint.sh /docker-entrypoint.sh +ENTRYPOINT ["/docker-entrypoint.sh"] + CMD ["/usr/sbin/nagios", "/etc/nagios/nagios.cfg"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..f2de375 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +[ -n "${MAILER_HOST}" ] && sed -r -i "/^mailhub=/s/.*/mailhub=${MAILER_HOST}/" /etc/ssmtp/ssmtp.conf + +exec $@