53443c5c71
With the move to RHEL/CentOS 8 we no longer have Python 2 in our images so there is no need for checking which Python version (2.x or 3.x) is used inside of containers. We also no longer have to support yum as a value for distro_package_manager. Partially-Implements: blueprint centos-rhel-8 Change-Id: Ie45cf3465fedddbde7856961527421883ba3d5c9
89 lines
2.8 KiB
Django/Jinja
89 lines
2.8 KiB
Django/Jinja
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
|
|
{% block labels %}
|
|
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
|
|
{% endblock %}
|
|
|
|
{% block monasca_grafana_header %}{% endblock %}
|
|
|
|
{% import "macros.j2" as macros with context %}
|
|
|
|
{{ macros.configure_user(name='monasca', homedir='/usr/share/grafana') }}
|
|
|
|
{% if base_package_type == 'rpm' %}
|
|
{% set monasca_grafana_build_packages = [
|
|
'golang',
|
|
'git',
|
|
'npm',
|
|
'bzip2',
|
|
'gcc-c++',
|
|
'make',
|
|
'ruby',
|
|
'ruby-devel',
|
|
'fontconfig',
|
|
'rpm-build'
|
|
] %}
|
|
{% elif base_package_type == 'deb' %}
|
|
{% set monasca_grafana_build_packages = [
|
|
'golang',
|
|
'git',
|
|
'npm',
|
|
'bzip2',
|
|
'g++',
|
|
'make',
|
|
'ruby',
|
|
'ruby-dev',
|
|
'fontconfig',
|
|
'rpm'
|
|
] %}
|
|
{% endif %}
|
|
|
|
{{ macros.install_packages(monasca_grafana_build_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
|
|
|
|
ENV GO_PATH=/grafana
|
|
ENV monasca_grafana_build_path=${GO_PATH}/src/github.com/grafana/grafana
|
|
ARG monasca_grafana_version=grafana4_2
|
|
ARG monasca_grafana_url=https://github.com/monasca/grafana/archive/$monasca_grafana_version.tar.gz
|
|
|
|
{% block monasca_grafana_install %}
|
|
# NOTE(yoctozepto): Update npm to 6.x version to avoid issues with metadata parsing.
|
|
# NPM installs itself in /usr/local/bin (the default in Ubuntu) which is not in the PATH.
|
|
# This is forced for all distros to avoid conflicts with native packages.
|
|
RUN gem install fpm \
|
|
&& curl -sSL -o /tmp/monasca-grafana.tgz ${monasca_grafana_url} \
|
|
&& mkdir -p ${monasca_grafana_build_path} \
|
|
&& tar --strip 1 -xvf /tmp/monasca-grafana.tgz -C ${monasca_grafana_build_path} \
|
|
&& rm -f /tmp/monasca-grafana.tgz \
|
|
&& cd ${monasca_grafana_build_path} \
|
|
&& go run build.go setup \
|
|
&& npm config set prefix /usr/local -g \
|
|
&& npm install npm@6.x -g \
|
|
&& /usr/local/bin/npm install \
|
|
&& go run build.go build package \
|
|
&& mv ${monasca_grafana_build_path}/dist /grafana_pkgs \
|
|
&& rm -rf /grafana
|
|
|
|
{% if base_package_type == 'rpm' %}
|
|
{% set monasca_grafana_packages = ['/grafana_pkgs/grafana*.rpm'] %}
|
|
{% elif base_package_type == 'deb' %}
|
|
{% set monasca_grafana_packages = ['/grafana_pkgs/grafana*.deb'] %}
|
|
{% endif %}
|
|
|
|
{{ macros.install_packages(monasca_grafana_packages | customizable("packages")) }}
|
|
|
|
{% endblock %}
|
|
|
|
RUN grafana-cli plugins install monasca-datasource \
|
|
&& chmod 750 /etc/sudoers.d \
|
|
&& chmod 440 /etc/sudoers.d/kolla_grafana_sudoers \
|
|
&& chmod 755 /usr/local/bin/kolla_extend_start
|
|
|
|
{% block monasca_grafana_footer %}{% endblock %}
|
|
{% block footer %}{% endblock %}
|
|
|
|
USER monasca
|