Maksim Malchuk 83efe32546 Unify curl use (customisation options)
This change adds and unifies an ability to override hardcoded URLs for
air-gapped environments via the usual blocks mechanism. Also, this
change replaces ENV with ARG instruction for the variables used only
in building images, and uses bash variable expansion where it possible.

This change is a continuation of the I46b77978926fc2b578a68d1aaa944b2198af0685

Change-Id: I1fbad333b1bc95484e6f4c5145d5936a0e2db84f
Signed-off-by: Maksim Malchuk <maksim.malchuk@gmail.com>
2022-03-11 15:58:05 +03:00

43 lines
1.3 KiB
Django/Jinja

FROM {{ namespace }}/{{ infra_image_prefix }}prometheus-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}
{% block prometheus_cadvisor_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{% block prometheus_cadvisor_repository_version %}
ARG prometheus_cadvisor_version=0.38.7
ARG prometheus_cadvisor_sha256sum=fdb86c256df682cfec2abd57a4405c919ed26f1e27ebfabf487f6c516bc7f6c7
ARG prometheus_cadvisor_url=https://github.com/google/cadvisor/releases/download/v${prometheus_cadvisor_version}/cadvisor
{% endblock %}
{% if base_arch in ['x86_64'] %}
{% block prometheus_cadvisor_install %}
RUN curl -o /tmp/cadvisor ${prometheus_cadvisor_url} \
&& echo "${prometheus_cadvisor_sha256sum} /tmp/cadvisor" | sha256sum -c \
&& mv /tmp/cadvisor /opt \
&& chmod 0755 /opt/cadvisor
{% endblock %}
{% else %}
{% if base_distro in ['debian'] %}
{% set cadvisor_packages = [
'libjs-bootstrap',
'libjs-jquery',
'cadvisor'
] %}
{{ macros.install_packages(cadvisor_packages | customizable("packages")) }}
RUN ln -s /usr/bin/cadvisor /opt/cadvisor
{% endif %}
{% endif %}
{% block prometheus_cadvisor_footer %}{% endblock %}
{% block footer %}{% endblock %}