1
- FROM phusion/baseimage:0.11 as build
1
+ FROM alpine:3.8 as base
2
2
LABEL maintainer=
"Denys Zhdanov <[email protected] >"
3
3
4
- RUN export DEBIAN_FRONTEND=noninteractive \
5
- && apt-get -y update \
6
- && apt-get -y upgrade \
7
- && apt-get -y install \
4
+ RUN true \
5
+ && apk add --no-cache \
6
+ cairo \
7
+ collectd \
8
+ collectd-disk \
9
+ collectd-nginx \
10
+ findutils \
11
+ librrd \
12
+ memcached \
13
+ nginx \
14
+ nodejs \
15
+ py3-pyldap \
16
+ redis \
17
+ runit \
18
+ sqlite \
19
+ && rm -rf \
20
+ /etc/nginx/conf.d/default.conf \
21
+ && mkdir -p \
22
+ /var/log/carbon \
23
+ /var/log/graphite
24
+
25
+ FROM base as build
26
+ LABEL maintainer=
"Denys Zhdanov <[email protected] >"
27
+
28
+ RUN true \
29
+ && apk add --update \
30
+ alpine-sdk \
8
31
git \
9
- libcairo2-dev \
10
32
libffi-dev \
11
- librrd-dev \
12
- nginx \
13
- pkg-config \
14
- python3-cairo \
33
+ pkgconfig \
34
+ py3-cairo \
35
+ py3-pip \
36
+ py3-pyldap \
37
+ py3-virtualenv \
38
+ py-rrd \
15
39
python3-dev \
16
- python3-ldap \
17
- python3-pip \
18
- python3-rrdtool \
19
- sqlite3 \
40
+ rrdtool-dev \
20
41
wget \
21
- && rm -rf /var/lib/apt/lists/*
22
-
23
- # fix python dependencies (LTS Django)
24
- RUN python3 -m pip install --upgrade virtualenv virtualenv-tools \
25
42
&& virtualenv /opt/graphite \
26
43
&& . /opt/graphite/bin/activate \
27
- && python3 -m pip install --upgrade pip \
28
44
&& pip3 install \
29
45
django==1.11.15 \
30
46
django-statsd-mozilla \
@@ -35,47 +51,48 @@ RUN python3 -m pip install --upgrade virtualenv virtualenv-tools \
35
51
rrdtool
36
52
37
53
ARG version=1.1.4
38
- ARG whisper_version=${version}
39
- ARG carbon_version=${version}
40
- ARG graphite_version=${version}
41
-
42
- ARG whisper_repo=https://github.com/graphite-project/whisper.git
43
- ARG carbon_repo=https://github.com/graphite-project/carbon.git
44
- ARG graphite_repo=https://github.com/graphite-project/graphite-web.git
45
-
46
- ARG statsd_version=v0.8.0
47
-
48
- ARG statsd_repo=https://github.com/etsy/statsd.git
49
54
50
55
# install whisper
51
- RUN git clone -b ${whisper_version} --depth 1 ${whisper_repo} /usr/local/src/whisper
52
- WORKDIR /usr/local/src/whisper
53
- RUN . /opt/graphite/bin/activate && python3 ./setup.py install
56
+ ARG whisper_version=${version}
57
+ ARG whisper_repo=https://github.com/graphite-project/whisper.git
58
+ RUN git clone -b ${whisper_version} --depth 1 ${whisper_repo} /usr/local/src/whisper \
59
+ && cd /usr/local/src/whisper \
60
+ && . /opt/graphite/bin/activate \
61
+ && python3 ./setup.py install
54
62
55
63
# install carbon
56
- RUN git clone -b ${carbon_version} --depth 1 ${carbon_repo} /usr/local/src/carbon
57
- WORKDIR /usr/local/src/carbon
58
- RUN . /opt/graphite/bin/activate && pip3 install -r requirements.txt \
59
- && python3 ./setup.py install
64
+ ARG carbon_version=${version}
65
+ ARG carbon_repo=https://github.com/graphite-project/carbon.git
66
+ RUN . /opt/graphite/bin/activate \
67
+ && git clone -b ${carbon_version} --depth 1 ${carbon_repo} /usr/local/src/carbon \
68
+ && cd /usr/local/src/carbon \
69
+ && pip3 install -r requirements.txt \
70
+ && python3 ./setup.py install
60
71
61
72
# install graphite
62
- RUN git clone -b ${graphite_version} --depth 1 ${graphite_repo} /usr/local/src/graphite-web
63
- WORKDIR /usr/local/src/graphite-web
64
- RUN . /opt/graphite/bin/activate && pip3 install -r requirements.txt \
65
- && python3 ./setup.py install
73
+ ARG graphite_version=${version}
74
+ ARG graphite_repo=https://github.com/graphite-project/graphite-web.git
75
+ RUN . /opt/graphite/bin/activate \
76
+ && git clone -b ${graphite_version} --depth 1 ${graphite_repo} /usr/local/src/graphite-web \
77
+ && cd /usr/local/src/graphite-web \
78
+ && pip3 install -r requirements.txt \
79
+ && python3 ./setup.py install
80
+
81
+ # install statsd (as we have to use this ugly way)
82
+ ARG statsd_version=8d5363cb109cc6363661a1d5813e0b96787c4411
83
+ ARG statsd_repo=https://github.com/etsy/statsd.git
84
+ RUN git init /opt/statsd \
85
+ && git -C /opt/statsd remote add origin "${statsd_repo}" \
86
+ && git -C /opt/statsd fetch origin "${statsd_version}" \
87
+ && git -C /opt/statsd checkout "${statsd_version}"
66
88
67
89
# fixing RRD support (see https://github.com/graphite-project/docker-graphite-statsd/issues/63)
68
90
RUN sed -i \
69
91
's/return os.path.realpath(fs_path)/return os.path.realpath(fs_path).decode("utf-8")/' \
70
92
/opt/graphite/webapp/graphite/readers/rrd.py
71
93
72
- # installing nodejs 6
73
- WORKDIR /opt
74
- RUN wget https://nodejs.org/download/release/v6.14.4/node-v6.14.4-linux-x64.tar.gz && \
75
- tar -xvpzf node-v6.14.4-linux-x64.tar.gz && rm node-v6.14.4-linux-x64.tar.gz && mv node-v6.14.4-linux-x64 nodejs
76
-
77
- # install statsd
78
- RUN git clone -b ${statsd_version} ${statsd_repo} /opt/statsd
94
+ COPY conf/opt/graphite/conf/ /opt/defaultconf/graphite/
95
+ COPY conf/opt/graphite/webapp/graphite/local_settings.py /opt/defaultconf/graphite/local_settings.py
79
96
80
97
# config graphite
81
98
COPY conf/opt/graphite/conf/*.conf /opt/graphite/conf/
@@ -85,56 +102,21 @@ RUN mkdir -p /var/log/graphite/ \
85
102
&& PYTHONPATH=/opt/graphite/webapp /opt/graphite/bin/django-admin.py collectstatic --noinput --settings=graphite.settings
86
103
87
104
# config statsd
88
- COPY conf/opt/statsd/config_*.js /opt/statsd/
105
+ COPY conf/opt/statsd/config/ /opt/defaultconf/ statsd/config /
89
106
90
- FROM phusion/baseimage:0.11 as production
107
+ FROM base as production
91
108
LABEL maintainer=
"Denys Zhdanov <[email protected] >"
92
109
93
110
ENV STATSD_INTERFACE udp
94
111
95
- # choose a timezone at build-time
96
- # use `--build-arg CONTAINER_TIMEZONE=Europe/Brussels` in `docker build`
97
- ARG CONTAINER_TIMEZONE
98
-
99
- RUN if [ ! -z "${CONTAINER_TIMEZONE}" ]; \
100
- then ln -sf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && \
101
- dpkg-reconfigure -f noninteractive tzdata; \
102
- fi
103
-
104
- RUN export DEBIAN_FRONTEND=noninteractive \
105
- && apt-get update --fix-missing \
106
- && apt-get -y upgrade \
107
- && apt-get install --yes --no-install-recommends \
108
- collectd \
109
- expect \
110
- git \
111
- libcairo2 \
112
- librrd-dev \
113
- memcached \
114
- nginx \
115
- python3-ldap \
116
- python3-pip \
117
- redis \
118
- sqlite3 \
119
- && apt-get clean \
120
- && apt-get autoremove --yes \
121
- && rm -rf \
122
- /var/lib/apt/lists/* \
123
- /etc/nginx/sites-enabled/default \
124
- && mkdir -p \
125
- /var/log/carbon \
126
- /var/log/graphite
127
-
128
112
COPY conf /
129
- COPY conf /etc/graphite-statsd/conf/
130
113
131
114
# copy /opt from build image
132
115
COPY --from=build /opt /opt
133
116
134
- RUN /usr/local/bin/django_admin_init.exp
135
117
136
118
# defaults
137
119
EXPOSE 80 2003-2004 2023-2024 8080 8125 8125/udp 8126
138
- VOLUME ["/opt/graphite/conf" , "/opt/graphite/storage" , "/opt/graphite/webapp/graphite/functions/custom" , "/etc/nginx" , "/opt/statsd" , "/etc/logrotate.d" , "/var/log" , "/var/lib/redis" ]
120
+ VOLUME ["/opt/graphite/conf" , "/opt/graphite/storage" , "/opt/graphite/webapp/graphite/functions/custom" , "/etc/nginx" , "/opt/statsd/config " , "/etc/logrotate.d" , "/var/log" , "/var/lib/redis" ]
139
121
140
- CMD ["/sbin/my_init " ]
122
+ ENTRYPOINT ["/entrypoint " ]
0 commit comments