-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathDockerfile
84 lines (64 loc) · 2.24 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
FROM ubuntu:18.04
ENV GRAFANA_VERSION 5.2.2
ENV INFLUXDB_VERSION 1.6.0
# Prevent some error messages
ENV DEBIAN_FRONTEND noninteractive
#RUN echo 'deb http://us.archive.ubuntu.com/ubuntu/ Utopic Unicorn' >> /etc/apt/sources.list
RUN apt-get -y update && apt-get -y upgrade
# ---------------- #
# Installation #
# ---------------- #
# Install all prerequisites
RUN apt-get -y install wget nginx-light supervisor curl
# Install Grafana to /src/grafana
RUN mkdir -p src/grafana && cd src/grafana && \
wget -nv https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-${GRAFANA_VERSION}.linux-amd64.tar.gz -O grafana.tar.gz && \
tar xzf grafana.tar.gz --strip-components=1 && rm grafana.tar.gz
# Install InfluxDB
RUN wget -nv https://dl.influxdata.com/influxdb/releases/influxdb_${INFLUXDB_VERSION}_amd64.deb && \
dpkg -i influxdb_${INFLUXDB_VERSION}_amd64.deb && rm influxdb_${INFLUXDB_VERSION}_amd64.deb
# ----------------- #
# Configuration #
# ----------------- #
# Configure InfluxDB
ADD influxdb/config.toml /etc/influxdb/config.toml
ADD influxdb/run.sh /usr/local/bin/run_influxdb
# These two databases have to be created. These variables are used by set_influxdb.sh and set_grafana.sh
ENV PRE_CREATE_DB data grafana
ENV INFLUXDB_HOST localhost:8086
ENV INFLUXDB_DATA_USER data
ENV INFLUXDB_DATA_PW data
ENV INFLUXDB_GRAFANA_USER grafana
ENV INFLUXDB_GRAFANA_PW grafana
ENV ROOT_PW root
# Configure Grafana
ADD ./grafana/config.ini /etc/grafana/config.ini
ADD grafana/run.sh /usr/local/bin/run_grafana
ADD ./configure.sh /configure.sh
ADD ./set_grafana.sh /set_grafana.sh
ADD ./set_influxdb.sh /set_influxdb.sh
RUN /configure.sh
# Configure nginx and supervisord
ADD ./nginx/nginx.conf /etc/nginx/nginx.conf
ADD ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# ----------- #
# Cleanup #
# ----------- #
RUN apt-get autoremove -y wget curl && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/* && rm /*.sh
# ---------------- #
# Expose Ports #
# ---------------- #
# Grafana
EXPOSE 3000
# InfluxDB Admin server
EXPOSE 8083
# InfluxDB HTTP API
EXPOSE 8086
# InfluxDB HTTPS API
EXPOSE 8084
# -------- #
# Run! #
# -------- #
CMD ["/usr/bin/supervisord"]