grafana/packaging/docker/custom/ubuntu.Dockerfile
Pureewat Kaewpoi 05d6d32f3e
Docker: Support pre-installing plugins from other sources in custom Dockerfiles (#31234)
Update custom Dockerfiles to support pre-installing plugins from other sources.

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
2021-03-11 12:17:34 +01:00

56 lines
1.8 KiB
Docker

ARG GRAFANA_VERSION="latest"
FROM grafana/grafana:${GRAFANA_VERSION}-ubuntu
USER root
# Set DEBIAN_FRONTEND=noninteractive in environment at build-time
ARG DEBIAN_FRONTEND=noninteractive
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"
RUN if [ $GF_INSTALL_IMAGE_RENDERER_PLUGIN = "true" ]; then \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y gdebi-core && \
cd /tmp && \
curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
gdebi --n google-chrome-stable_current_amd64.deb && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*; \
fi
USER grafana
ENV GF_RENDERER_PLUGIN_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); \
pluginWithoutUrl=$(echo "$plugin" | cut -d';' -f 2); \
grafana-cli --pluginUrl "${pluginUrl}" --pluginsDir "${GF_PATHS_PLUGINS}" plugins install ${pluginWithoutUrl}; \
else \
grafana-cli --pluginsDir "${GF_PATHS_PLUGINS}" plugins install ${plugin}; \
fi \
done \
fi