From bbdba5e7dff25c14db2245f4341a53c0f818e627 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 8 Jan 2025 16:59:40 -0500 Subject: [PATCH] build(container): rebase to centos9-stream (#78) --- Dockerfile | 65 +++++++++++++++++++++++++++++++++++-------------- entrypoint.bash | 12 +++++++++ 2 files changed, 59 insertions(+), 18 deletions(-) create mode 100755 entrypoint.bash diff --git a/Dockerfile b/Dockerfile index f24cf63..2baebdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,55 @@ -FROM docker.io/grafana/grafana:10.4.3 - -EXPOSE 3000 - -RUN grafana cli plugins install yesoreyeram-infinity-datasource - -COPY --chown=grafana:root \ - dashboards.yaml \ - dashboards/*.dashboard.json \ - /etc/grafana/provisioning/dashboards/ - -COPY --chown=grafana:root \ +FROM quay.io/centos/centos:stream9-minimal +ARG UID=101 +ARG PORT=3000 + +WORKDIR /usr/share/grafana +ENV VERSION=10 +ENV GF_PATHS_HOME=/usr/share/grafana +ENV HOME=/usr/share/grafana +ENV GF_PATHS_PROVISIONING=/etc/grafana/provisioning +ENV GF_PATHS_DATA=/var/lib/grafana +ENV GF_PATHS_LOGS=/var/log/grafana +ENV GF_PATHS_PLUGINS=/var/lib/grafana/plugins +ENV GF_PATHS_CONFIG=/etc/grafana/grafana.ini + +LABEL name="cryostat/cryostat-grafana-dashboard" \ + version="${VERSION}" \ + usage="podman run -d --name grafana -p ${PORT}:${PORT} -v grafana-data:${GF_PATHS_DATA} quay.io/cryostat/cryostat-grafana-dashboard" \ + maintainer="Cryostat Maintainers " \ + io.k8s.display-name="Grafana" \ + io.openshift.expose-services="3000:grafana" \ + io.openshift.tags="grafana,monitoring,dashboard" + +RUN useradd -u ${UID} -g 0 -r -d $GF_PATHS_HOME -s /sbin/nologin grafana && \ + microdnf upgrade -y && \ + microdnf install -y --setopt=tsflags=nodocs grafana && \ + microdnf clean all && \ + chgrp -R 0 /etc/grafana /var/lib/grafana /var/log/grafana && \ + chmod -R g=u /var/lib/grafana /var/log/grafana && \ + /usr/sbin/grafana cli plugins install yesoreyeram-infinity-datasource + +COPY --chown=grafana:grafana \ + dashboards.yaml \ + dashboards/*.dashboard.json \ + ${GF_PATHS_PROVISIONING}/dashboards/ + +COPY --chown=grafana:grafana \ datasource.yaml \ - /etc/grafana/provisioning/datasources/ + ${GF_PATHS_PROVISIONING}/datasources/ -COPY --chown=grafana:root \ +COPY --chown=grafana:grafana \ grafana.ini \ - /etc/grafana/grafana.ini + ${GF_PATHS_CONFIG} + +COPY --chown=grafana:grafana \ + entrypoint.bash \ + /usr/bin/run-grafana # Listen address of jfr-datasource ENV JFR_DATASOURCE_URL "http://0.0.0.0:8080" -# User grafana -USER 472 +USER ${UID} + +EXPOSE ${PORT} -ENTRYPOINT [ "/run.sh" ] +ENTRYPOINT [ "/usr/bin/run-grafana" ] diff --git a/entrypoint.bash b/entrypoint.bash new file mode 100755 index 0000000..8a2680a --- /dev/null +++ b/entrypoint.bash @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +exec /usr/sbin/grafana-server \ + --homepath="$GF_PATHS_HOME" \ + --config="$GF_PATHS_CONFIG" \ + --packaging=docker \ + "$@" \ + cfg:default.log.mode="console" \ + cfg:default.paths.data="$GF_PATHS_DATA" \ + cfg:default.paths.logs="$GF_PATHS_LOGS" \ + cfg:default.paths.plugins="$GF_PATHS_PLUGINS" \ + cfg:default.paths.provisioning="$GF_PATHS_PROVISIONING"