mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Build: Unify custom dockerfiles, fix missing semicolon (#59615)
* unify custom dockerfiles, fix missing semicolon * tweak verbiage Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> * update example description Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
This commit is contained in:
@@ -2,23 +2,35 @@ ARG GRAFANA_VERSION="latest"
|
||||
|
||||
FROM grafana/grafana:${GRAFANA_VERSION}
|
||||
|
||||
USER root
|
||||
|
||||
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
|
||||
|
||||
RUN mkdir -p "$GF_PATHS_PLUGINS" && \
|
||||
chown -R grafana:${GF_GID} "$GF_PATHS_PLUGINS" && \
|
||||
if [ $GF_INSTALL_IMAGE_RENDERER_PLUGIN = "true" ]; then \
|
||||
apk add --no-cache udev ttf-opensans chromium \
|
||||
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
|
||||
|
||||
ENV GF_PLUGIN_RENDERING_CHROME_BIN="/usr/bin/chromium-browser"
|
||||
|
||||
RUN if [ $GF_INSTALL_IMAGE_RENDERER_PLUGIN = "true" ]; then \
|
||||
grafana-cli \
|
||||
--pluginsDir "$GF_PATHS_PLUGINS" \
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
ARG GRAFANA_VERSION="latest"
|
||||
|
||||
FROM grafana/grafana:${GRAFANA_VERSION}-ubuntu
|
||||
|
||||
USER root
|
||||
|
||||
ARG GF_INSTALL_IMAGE_RENDERER_PLUGIN="false"
|
||||
|
||||
ARG GF_GID="0"
|
||||
ENV GF_PATHS_PLUGINS="/var/lib/grafana-plugins"
|
||||
|
||||
RUN mkdir -p "$GF_PATHS_PLUGINS" && \
|
||||
chown -R grafana:${GF_GID} "$GF_PATHS_PLUGINS" && \
|
||||
if [ $GF_INSTALL_IMAGE_RENDERER_PLUGIN = "true" ]; then \
|
||||
cd /tmp && \
|
||||
curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
|
||||
DEBIAN_FRONTEND=noninteractive && \
|
||||
apt-get update && \
|
||||
apt-get install -y ./google-chrome-stable_current_amd64.deb && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
rm ./google-chrome-stable_current_amd64.deb \
|
||||
fi
|
||||
|
||||
USER grafana
|
||||
|
||||
ENV GF_PLUGIN_RENDERING_CHROME_BIN="/usr/bin/google-chrome"
|
||||
|
||||
RUN if [ $GF_INSTALL_IMAGE_RENDERER_PLUGIN = "true" ]; then \
|
||||
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
|
||||
|
||||
ARG GF_INSTALL_PLUGINS=""
|
||||
|
||||
RUN if [ ! -z "${GF_INSTALL_PLUGINS}" ]; then \
|
||||
OLDIFS=$IFS; \
|
||||
IFS=','; \
|
||||
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
|
||||
Reference in New Issue
Block a user