-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
75 lines (60 loc) · 2.67 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
ARG GRAFANA_VERSION="latest"
FROM grafana/grafana-enterprise:${GRAFANA_VERSION}
ARG GF_INSTALL_IMAGE_RENDERER_PLUGIN="false"
ARG GF_GID="0"
ENV GF_PATHS_PLUGINS="/var/lib/grafana-plugins"
ENV GF_PLUGIN_RENDERING_CHROME_BIN="/usr/bin/chrome"
USER root
EXPOSE 3030
RUN mkdir -p /etc/grafana/provisioning/dashboards
RUN mkdir -p /etc/grafana/provisioning/datasources
COPY ./grafana-dashboards/home.json /etc/grafana/provisioning/dashboards/home.json
COPY ./config/dashboards.yaml /etc/grafana/provisioning/dashboards/dashboards.yaml
COPY ./config/datasources.yaml /etc/grafana/provisioning/datasources/datasources.yaml
RUN mkdir -p "$GF_PATHS_PLUGINS" && \
chown -R grafana:${GF_GID} "$GF_PATHS_PLUGINS" && \
if [ $GF_INSTALL_IMAGE_RENDERER_PLUGIN = "true" ]; then \
if grep -i -q alpine /etc/issue; then \
apk add --no-cache udev ttf-opensans chromium && \
ln -s /usr/bin/chromium-browser "$GF_PLUGIN_RENDERING_CHROME_BIN"; \
else \
cd /tmp && \
curl -sLO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
DEBIAN_FRONTEND=noninteractive && \
apt-get update -q && \
apt-get install -q -y ./google-chrome-stable_current_amd64.deb && \
rm -rf /var/lib/apt/lists/* && \
rm ./google-chrome-stable_current_amd64.deb && \
ln -s /usr/bin/google-chrome "$GF_PLUGIN_RENDERING_CHROME_BIN"; \
fi \
fi
USER grafana
RUN if [ $GF_INSTALL_IMAGE_RENDERER_PLUGIN = "true" ]; then \
if grep -i -q alpine /etc/issue; then \
grafana-cli \
--pluginsDir "$GF_PATHS_PLUGINS" \
--pluginUrl https://github.com/grafana/grafana-image-renderer/releases/latest/download/plugin-alpine-x64-no-chromium.zip \
plugins install grafana-image-renderer; \
else \
grafana-cli \
--pluginsDir "$GF_PATHS_PLUGINS" \
--pluginUrl https://github.com/grafana/grafana-image-renderer/releases/latest/download/plugin-linux-x64-glibc-no-chromium.zip \
plugins install grafana-image-renderer; \
fi \
fi
ARG GF_INSTALL_PLUGINS=""
RUN if [ ! -z "${GF_INSTALL_PLUGINS}" ]; then \
OLDIFS=$IFS; \
IFS=','; \
set -e ; \
for plugin in ${GF_INSTALL_PLUGINS}; do \
IFS=$OLDIFS; \
if expr match "$plugin" '.*\;.*'; then \
pluginUrl=$(echo "$plugin" | cut -d';' -f 1); \
pluginInstallFolder=$(echo "$plugin" | cut -d';' -f 2); \
grafana-cli --pluginUrl ${pluginUrl} --pluginsDir "${GF_PATHS_PLUGINS}" plugins install "${pluginInstallFolder}"; \
else \
grafana-cli --pluginsDir "${GF_PATHS_PLUGINS}" plugins install ${plugin}; \
fi \
done \
fi