kolla/docker/grafana/Dockerfile.j2
Dawud 077e0003d4
Change logic for plugins in grafana image build
Co-authored-by:  Will Szumski <will@stackhpc.com>
Change-Id: I2b1c95395aeefb2ccb1d8edf415eee0f98c52190
2024-06-28 01:19:10 +01:00

41 lines
1.3 KiB
Django/Jinja

FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}
{% block grafana_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{{ macros.enable_extra_repos(['grafana']) }}
{% set grafana_packages = ['grafana'] %}
{{ macros.configure_user(name='grafana', homedir='/usr/share/grafana') }}
{{ macros.install_packages(grafana_packages | customizable("packages")) }}
WORKDIR /usr/share/grafana
COPY grafana_sudoers /etc/sudoers.d/kolla_grafana_sudoers
COPY extend_start.sh /usr/local/bin/kolla_extend_start
{% block grafana_plugins_install %}
{% set grafana_default_plugins = ['gnocchixyz-gnocchi-datasource', 'grafana-opensearch-datasource'] %}
{% set grafana_plugins = grafana_default_plugins | customizable("plugins") %}
{% if grafana_plugins | length > 0 %}
RUN {{ (['grafana-cli plugins install %s'] * grafana_plugins | length ) | join(' && ') | format(*grafana_plugins) }}
{% endif %}
{% endblock %}
RUN chmod 750 /etc/sudoers.d \
&& chmod 440 /etc/sudoers.d/kolla_grafana_sudoers \
&& chmod 644 /usr/local/bin/kolla_extend_start
{% block grafana_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER grafana