Dockerfile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. FROM phusion/baseimage:0.9.22
  2. MAINTAINER Denys Zhdanov <denis.zhdanov@gmail.com>
  3. RUN apt-get -y update \
  4. && apt-get -y upgrade \
  5. && apt-get -y install vim \
  6. nginx \
  7. python-dev \
  8. python-flup \
  9. python-pip \
  10. python-ldap \
  11. expect \
  12. git \
  13. memcached \
  14. sqlite3 \
  15. libffi-dev \
  16. libcairo2 \
  17. libcairo2-dev \
  18. python-cairo \
  19. python-rrdtool \
  20. pkg-config \
  21. nodejs \
  22. && rm -rf /var/lib/apt/lists/*
  23. # choose a timezone at build-time
  24. # use `--build-arg CONTAINER_TIMEZONE=Europe/Brussels` in `docker build`
  25. ARG CONTAINER_TIMEZONE
  26. ENV DEBIAN_FRONTEND noninteractive
  27. RUN if [ ! -z "${CONTAINER_TIMEZONE}" ]; \
  28. then ln -sf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && \
  29. dpkg-reconfigure -f noninteractive tzdata; \
  30. fi
  31. # fix python dependencies (LTS Django and newer memcached/txAMQP)
  32. RUN pip install --upgrade pip && \
  33. pip install django==1.8.18 \
  34. python-memcached==1.53 \
  35. txAMQP==0.6.2
  36. ARG version=1.0.2
  37. ARG whisper_version=${version}
  38. ARG carbon_version=${version}
  39. ARG graphite_version=${version}
  40. ARG statsd_version=v0.7.2
  41. # install whisper
  42. RUN git clone -b ${whisper_version} --depth 1 https://github.com/graphite-project/whisper.git /usr/local/src/whisper
  43. WORKDIR /usr/local/src/whisper
  44. RUN python ./setup.py install
  45. # install carbon
  46. RUN git clone -b ${carbon_version} --depth 1 https://github.com/graphite-project/carbon.git /usr/local/src/carbon
  47. WORKDIR /usr/local/src/carbon
  48. RUN pip install -r requirements.txt \
  49. && python ./setup.py install
  50. # install graphite
  51. RUN git clone -b ${graphite_version} --depth 1 https://github.com/graphite-project/graphite-web.git /usr/local/src/graphite-web
  52. WORKDIR /usr/local/src/graphite-web
  53. RUN pip install -r requirements.txt \
  54. && python ./setup.py install
  55. ADD conf/opt/graphite/conf/*.conf /opt/graphite/conf/
  56. ADD conf/opt/graphite/webapp/graphite/local_settings.py /opt/graphite/webapp/graphite/local_settings.py
  57. # ADD conf/opt/graphite/webapp/graphite/app_settings.py /opt/graphite/webapp/graphite/app_settings.py
  58. WORKDIR /opt/graphite/webapp
  59. RUN mkdir -p /var/log/graphite/ \
  60. && PYTHONPATH=/opt/graphite/webapp django-admin.py collectstatic --noinput --settings=graphite.settings
  61. # install statsd
  62. RUN git clone -b ${statsd_version} https://github.com/etsy/statsd.git /opt/statsd
  63. ADD conf/opt/statsd/config.js /opt/statsd/config.js
  64. # config nginx
  65. RUN rm /etc/nginx/sites-enabled/default
  66. ADD conf/etc/nginx/nginx.conf /etc/nginx/nginx.conf
  67. ADD conf/etc/nginx/sites-enabled/graphite-statsd.conf /etc/nginx/sites-enabled/graphite-statsd.conf
  68. # init django admin
  69. ADD conf/usr/local/bin/django_admin_init.exp /usr/local/bin/django_admin_init.exp
  70. ADD conf/usr/local/bin/manage.sh /usr/local/bin/manage.sh
  71. RUN chmod +x /usr/local/bin/manage.sh && /usr/local/bin/django_admin_init.exp
  72. # logging support
  73. RUN mkdir -p /var/log/carbon /var/log/graphite /var/log/nginx
  74. ADD conf/etc/logrotate.d/graphite-statsd /etc/logrotate.d/graphite-statsd
  75. # daemons
  76. ADD conf/etc/service/carbon/run /etc/service/carbon/run
  77. ADD conf/etc/service/carbon-aggregator/run /etc/service/carbon-aggregator/run
  78. ADD conf/etc/service/graphite/run /etc/service/graphite/run
  79. ADD conf/etc/service/statsd/run /etc/service/statsd/run
  80. ADD conf/etc/service/nginx/run /etc/service/nginx/run
  81. # default conf setup
  82. ADD conf /etc/graphite-statsd/conf
  83. ADD conf/etc/my_init.d/01_conf_init.sh /etc/my_init.d/01_conf_init.sh
  84. # cleanup
  85. RUN apt-get clean\
  86. && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  87. # defaults
  88. EXPOSE 80 2003-2004 2023-2024 8125/udp 8126
  89. VOLUME ["/opt/graphite/conf", "/opt/graphite/storage", "/etc/nginx", "/opt/statsd", "/etc/logrotate.d", "/var/log"]
  90. WORKDIR /
  91. ENV HOME /root
  92. CMD ["/sbin/my_init"]