FROM alpine:latest MAINTAINER Suren Chilingaryan ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.8/supercronic-linux-amd64 \ SUPERCRONIC=supercronic-linux-amd64 \ SUPERCRONIC_SHA1SUM=be43e64c45acd6ec4fce5831e03759c89676a0ea VOLUME /munin/db #Only small temporary files, doesn't need volume #VOLUME /var/lib/nginx RUN packages="munin nginx wget heirloom-mailx patch spawn-fcgi perl-cgi-fast curl busybox-extras font-adobe-75dpi"; \ apk update && apk upgrade && apk add --no-cache $packages \ && curl -fsSLO "$SUPERCRONIC_URL" \ && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ && chmod +x "$SUPERCRONIC" \ && mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ && ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic ADD ./munin.conf /etc/munin/munin.conf ADD ./nginx.conf /etc/nginx/nginx.conf ADD ./nginx-munin /etc/nginx/sites-enabled/munin ADD ./start-munin.sh /munin.sh ADD ./patches /patches # rsyslog is not actually used, but I keep here configuration just in case # Nginx always creates error_log in /var/log/nginx, but doesn't write there if other locating is configured RUN \ #sed -i -e 's|^$FileOwner|#$FileOwner|' "/etc/rsyslog.conf" && \ #sed -i -e 's|^$FileGroup|#$FileGroup|' "/etc/rsyslog.conf" && \ #sed -i -e 's|^$PrivDrop|#$PrivDrop|' "/etc/rsyslog.conf" && \ #sed -i -e 's|^$ModLoad imuxsock|#$ModLoad imuxsock|' "/etc/rsyslog.conf" && \ #sed -i -e 's|^$ModLoad imklog|#$ModLoad imklog|' "/etc/rsyslog.conf" && \ \ rm -rf /var/log/nginx && \ ln -s /tmp /var/log/nginx && \ ln -s /tmp /var/lib/nginx/logs && \ rm -f /etc/nginx/conf.d/default.conf && \ rm -f /etc/nginx/sites-enabled/default && \ \ ln -s /usr/share/webapps/munin/cgi /usr/lib/munin/cgi && \ cd /usr/lib/munin && patch munin-graph < /patches/munin-graph-logging.patch && patch munin-update < /patches/munin-update-logging.patch && \ cd /usr/share/perl5/vendor_perl/Munin/Master/ && patch Update.pm < /patches/munin-ds-datalock.patch && \ sed -re "/@[[:alnum:]]+/ d; s|munin if|if|" /etc/munin/munin.cron.sample > /etc/munin/munin.cron && \ \ bash -c "mkdir -p /munin/{db,log,www/cache}" && \ ln -s ../www/cache /munin/db/cgi-tmp && \ rm -rf /var/lib/munin/cgi-tmp && \ ln -s /munin/www/cache /var/lib/munin/cgi-tmp && \ \ chgrp -R root /munin /var/run/munin /etc/munin/munin.conf /var/tmp/nginx /var/lib/nginx && \ chmod -R g+rw /munin /var/run/munin /etc/munin/munin.conf /var/tmp/nginx && \ for name in "/var/tmp/nginx /munin/"; do find $name -type d -print0 | xargs -0 chmod g+x; done EXPOSE 8080 CMD ["bash", "/munin.sh"]