kolla/docker/monasca/monasca-thresh/Dockerfile.j2
Mark Goddard 93204ecfec Add a storm-base image
Refactor storm image dependencies. Previously we had:

base -> storm -> monasca-thresh

Both storm and monasca-thresh images are final, and each includes a
footer. This causes issues when the footer expects to be at the end of
the image, or there to be only a single footer. In particular, since
I2592a736206eaec811290e9fbdbf2540c0518ffe, the footer used in CI jobs
reverts to the public package mirrors.

This change introduces a storm-base image, and refactors the dependency
chain:

base -> storm-base -> storm
base -> storm-base -> monasca-thresh

Related-Bug: #1902101

Change-Id: I53e8ba8d4baa4434cf3c49ed94d1f7cb44099bee
2021-01-12 16:21:32 +00:00

76 lines
2.2 KiB
Django/Jinja

FROM {{ namespace }}/{{ infra_image_prefix }}storm-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}
{% block monasca_thresh_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{{ macros.add_binary_source_envs() }}
{{ macros.configure_user(name='monasca') }}
{% if install_type == 'binary' %}
RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
&& /bin/false
{% elif install_type == 'source' %}
{% if base_package_type == 'rpm' %}
{% set monasca_thresh_packages = [
'maven',
] %}
ENV JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk/
{% elif base_package_type == 'deb' %}
{% if base_distro == 'debian' %}
{% set java_version = '11' %}
{% elif base_distro == 'ubuntu' %}
{% set java_version = '8' %}
{% endif %}
{% set monasca_thresh_packages = [
'openjdk-' + java_version + '-jdk-headless',
'maven',
] %}
ENV JAVA_HOME /usr/lib/jvm/java-{{java_version}}-openjdk-{{debian_arch}}/
{% endif %}
{{ macros.install_packages(monasca_thresh_packages | customizable("packages")) }}
ADD monasca-thresh-archive /monasca-thresh-source
ADD additions/monasca-common* /monasca-common-source
{% block monasca_thresh_source_install %}
{% set build_opts = ['-DskipTests'] %}
# FIXME(dszumski): Remove this when the following bug is fixed:
# https://bugs.launchpad.net/ubuntu/+source/ca-certificates-java/+bug/1770553
{% if base_distro == 'ubuntu' %}
{% set build_opts = build_opts + ['-Djavax.net.ssl.trustStorePassword=changeit'] %}
{% endif %}
RUN cd /monasca-common-source/java \
&& mvn clean install {{ build_opts|join(' ') }} \
&& cd /monasca-thresh-source/monasca-thresh-*/thresh \
&& mvn clean package {{ build_opts|join(' ') }}
{% endblock %}
{% endif %}
# Overwrite the script inherited from Storm
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN touch /usr/local/bin/kolla_monasca_extend_start \
&& chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_monasca_extend_start
{% block monasca_thresh_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER monasca