Dockerfile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 whisper_repo=https://github.com/graphite-project/whisper.git
  41. ARG carbon_repo=https://github.com/graphite-project/carbon.git
  42. ARG graphite_repo=https://github.com/graphite-project/graphite-web.git
  43. ARG statsd_version=v0.8.0
  44. ARG statsd_repo=https://github.com/etsy/statsd.git
  45. # install whisper
  46. RUN git clone -b ${whisper_version} --depth 1 ${whisper_repo} /usr/local/src/whisper
  47. WORKDIR /usr/local/src/whisper
  48. RUN python ./setup.py install
  49. # install carbon
  50. RUN git clone -b ${carbon_version} --depth 1 ${carbon_repo} /usr/local/src/carbon
  51. WORKDIR /usr/local/src/carbon
  52. RUN pip install -r requirements.txt \
  53. && python ./setup.py install
  54. # install graphite
  55. RUN git clone -b ${graphite_version} --depth 1 ${graphite_repo} /usr/local/src/graphite-web
  56. WORKDIR /usr/local/src/graphite-web
  57. RUN pip install -r requirements.txt \
  58. && python ./setup.py install
  59. # install statsd
  60. RUN git clone -b ${statsd_version} ${statsd_repo} /opt/statsd
  61. # config graphite
  62. ADD conf/opt/graphite/conf/*.conf /opt/graphite/conf/
  63. ADD conf/opt/graphite/webapp/graphite/local_settings.py /opt/graphite/webapp/graphite/local_settings.py
  64. # ADD conf/opt/graphite/webapp/graphite/app_settings.py /opt/graphite/webapp/graphite/app_settings.py
  65. WORKDIR /opt/graphite/webapp
  66. RUN mkdir -p /var/log/graphite/ \
  67. && PYTHONPATH=/opt/graphite/webapp django-admin.py collectstatic --noinput --settings=graphite.settings
  68. # config statsd
  69. ADD conf/opt/statsd/config_*.js /opt/statsd/
  70. # config nginx
  71. RUN rm /etc/nginx/sites-enabled/default
  72. ADD conf/etc/nginx/nginx.conf /etc/nginx/nginx.conf
  73. ADD conf/etc/nginx/sites-enabled/graphite-statsd.conf /etc/nginx/sites-enabled/graphite-statsd.conf
  74. # init django admin
  75. ADD conf/usr/local/bin/django_admin_init.exp /usr/local/bin/django_admin_init.exp
  76. ADD conf/usr/local/bin/manage.sh /usr/local/bin/manage.sh
  77. RUN chmod +x /usr/local/bin/manage.sh && /usr/local/bin/django_admin_init.exp
  78. # logging support
  79. RUN mkdir -p /var/log/carbon /var/log/graphite /var/log/nginx
  80. ADD conf/etc/logrotate.d/graphite-statsd /etc/logrotate.d/graphite-statsd
  81. # daemons
  82. ADD conf/etc/service/carbon/run /etc/service/carbon/run
  83. ADD conf/etc/service/carbon-aggregator/run /etc/service/carbon-aggregator/run
  84. ADD conf/etc/service/graphite/run /etc/service/graphite/run
  85. ADD conf/etc/service/statsd/run /etc/service/statsd/run
  86. ADD conf/etc/service/nginx/run /etc/service/nginx/run
  87. # default conf setup
  88. ADD conf /etc/graphite-statsd/conf
  89. ADD conf/etc/my_init.d/01_conf_init.sh /etc/my_init.d/01_conf_init.sh
  90. # cleanup
  91. RUN apt-get clean\
  92. && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  93. # defaults
  94. EXPOSE 80 2003-2004 2023-2024 8125 8125/udp 8126
  95. VOLUME ["/opt/graphite/conf", "/opt/graphite/storage", "/etc/nginx", "/opt/statsd", "/etc/logrotate.d", "/var/log"]
  96. WORKDIR /
  97. ENV HOME /root
  98. ENV STATSD_INTERFACE udp
  99. CMD ["/sbin/my_init"]