Skip to content

Instantly share code, notes, and snippets.

@iamoverit
Created December 10, 2020 08:40
Show Gist options
  • Save iamoverit/c5b8d36ce224cca7479c7c5270586cca to your computer and use it in GitHub Desktop.
Save iamoverit/c5b8d36ce224cca7479c7c5270586cca to your computer and use it in GitHub Desktop.
docker build --build-arg "GRAFANA_VERSION=latest" --build-arg "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource,vertamedia-clickhouse-datasource" -t grafana-local -f grafana_Dockerfile .
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"
ENV GF_PATHS_PLUGINS="/var/lib/grafana-plugins"
RUN mkdir -p "$GF_PATHS_PLUGINS" && \
chown -R grafana:grafana "$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; \
grafana-cli --pluginsDir "$GF_PATHS_PLUGINS" plugins install ${plugin}; \
done; \
fi
docker run --env GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=vertamedia-clickhouse-datasource -d -p 127.0.0.1:3000:3000 --name=grafana grafana-local 2>/dev/null | docker start grafana
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment