Dockerfile 3.8 KB

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