Dockerfile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. FROM alpine:latest
  2. MAINTAINER Suren Chilingaryan <csa@suren.me>
  3. ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.8/supercronic-linux-amd64 \
  4. SUPERCRONIC=supercronic-linux-amd64 \
  5. SUPERCRONIC_SHA1SUM=be43e64c45acd6ec4fce5831e03759c89676a0ea
  6. VOLUME /munin/db
  7. #Only small temporary files, doesn't need volume
  8. #VOLUME /var/lib/nginx
  9. RUN packages="munin nginx wget heirloom-mailx patch spawn-fcgi perl-cgi-fast curl busybox-extras font-adobe-75dpi"; \
  10. apk update && apk upgrade && apk add --no-cache $packages \
  11. && curl -fsSLO "$SUPERCRONIC_URL" \
  12. && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \
  13. && chmod +x "$SUPERCRONIC" \
  14. && mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
  15. && ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic
  16. ADD ./munin.conf /etc/munin/munin.conf
  17. ADD ./nginx.conf /etc/nginx/nginx.conf
  18. ADD ./nginx-munin /etc/nginx/sites-enabled/munin
  19. ADD ./start-munin.sh /munin.sh
  20. ADD ./patches /patches
  21. # rsyslog is not actually used, but I keep here configuration just in case
  22. # Nginx always creates error_log in /var/log/nginx, but doesn't write there if other locating is configured
  23. RUN \
  24. #sed -i -e 's|^$FileOwner|#$FileOwner|' "/etc/rsyslog.conf" && \
  25. #sed -i -e 's|^$FileGroup|#$FileGroup|' "/etc/rsyslog.conf" && \
  26. #sed -i -e 's|^$PrivDrop|#$PrivDrop|' "/etc/rsyslog.conf" && \
  27. #sed -i -e 's|^$ModLoad imuxsock|#$ModLoad imuxsock|' "/etc/rsyslog.conf" && \
  28. #sed -i -e 's|^$ModLoad imklog|#$ModLoad imklog|' "/etc/rsyslog.conf" && \
  29. \
  30. rm -rf /var/log/nginx && \
  31. ln -s /tmp /var/log/nginx && \
  32. ln -s /tmp /var/lib/nginx/logs && \
  33. rm -f /etc/nginx/conf.d/default.conf && \
  34. rm -f /etc/nginx/sites-enabled/default && \
  35. \
  36. ln -s /usr/share/webapps/munin/cgi /usr/lib/munin/cgi && \
  37. cd /usr/lib/munin && patch munin-graph < /patches/munin-graph-logging.patch && patch munin-update < /patches/munin-update-logging.patch && \
  38. cd /usr/share/perl5/vendor_perl/Munin/Master/ && patch Update.pm < /patches/munin-ds-datalock.patch && \
  39. sed -re "/@[[:alnum:]]+/ d; s|munin if|if|" /etc/munin/munin.cron.sample > /etc/munin/munin.cron && \
  40. \
  41. bash -c "mkdir -p /munin/{db,log,www/cache}" && \
  42. ln -s ../www/cache /munin/db/cgi-tmp && \
  43. rm -rf /var/lib/munin/cgi-tmp && \
  44. ln -s /munin/www/cache /var/lib/munin/cgi-tmp && \
  45. \
  46. chgrp -R root /munin /etc/munin/munin.conf /var/tmp/nginx /var/lib/nginx && \
  47. chmod -R g+rw /munin /etc/munin/munin.conf /var/tmp/nginx && \
  48. for name in "/var/tmp/nginx /munin/"; do find $name -type d -print0 | xargs -0 chmod g+x; done
  49. EXPOSE 8080
  50. CMD ["bash", "/munin.sh"]