aboutsummaryrefslogtreecommitdiff
path: root/docker/horizon/Dockerfile.j2
blob: b854ca0f6b3bb1b95fb04b65f7a85974e4f1fc27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}

{% block horizon_header %}{% endblock %}

{% import "macros.j2" as macros with context %}

{{ macros.configure_user(name='horizon') }}

{% if base_package_type == 'rpm' %}

    {% set horizon_packages = [
        'gettext'
    ] %}

{{ macros.install_packages(horizon_packages | customizable("packages")) }}
{% elif base_package_type == 'deb' %}

    {% set horizon_packages = [
        'gettext',
        'locales',
        'tzdata'
    ] %}

{{ macros.install_packages(horizon_packages | customizable("packages")) }}

{% block horizon_ubuntu_source_setup %}
RUN ln -s ../mods-available/headers.load  /etc/apache2/mods-enabled/headers.load
{% endblock %}

{% endif %}

ADD horizon-archive /horizon-source
ADD plugins-archive /

{% set horizon_pip_packages = [
    '/horizon'
] %}

{% set horizon_plugins_pip_packages = [
    '/plugins/*'
] %}

COPY extend_start.sh /usr/local/bin/kolla_extend_start

# NOTE(hrw): to install horizon from unpacked sources we cannot have it in upper-constraints.txt
# NOTE(kevko): This dance with local settings python paths below is needed
# because we are using different distros with different python version and we need to
# know to which path symlink should point to.
# NOTE(bbezak): pin setuptools for pip build isolation due to
# https://bugs.launchpad.net/horizon/+bug/2141293
RUN ln -s horizon-source/* horizon \
    && {{ macros.upper_constraints_remove("horizon") }} \
    && echo "setuptools<82" > /tmp/horizon-build-constraints.txt \
    && PIP_BUILD_CONSTRAINT=/tmp/horizon-build-constraints.txt \
       {{ macros.install_pip(horizon_pip_packages | customizable("pip_packages")) }} \
    && mkdir -p /etc/openstack-dashboard \
    && cp -r /horizon/openstack_dashboard/conf/* /etc/openstack-dashboard/ \
    && cp /horizon/openstack_dashboard/local/local_settings.py.example /etc/openstack-dashboard/local_settings.py \
    && local_settings=$(python -c 'import os;import openstack_dashboard;settings=os.path.dirname(openstack_dashboard.__file__) + "/local/local_settings.py";print(settings);') \
    && rm -f $local_settings \
    && ln -s /etc/openstack-dashboard/local_settings.py $local_settings \
    && mkdir -p /etc/openstack-dashboard/local_settings.d \
    && local_settings_d=$(python -c 'import os;import openstack_dashboard;settings_d=os.path.dirname(openstack_dashboard.__file__) + "/local/local_settings.d";print(settings_d);') \
    && rm -rf $local_settings_d \
    && ln -s /etc/openstack-dashboard/local_settings.d $local_settings_d \
    && cp /horizon/manage.py /var/lib/kolla/venv/bin/manage.py \
    && if [ "$(ls /plugins)" ]; then \
           {{ macros.install_pip(horizon_plugins_pip_packages) }}; \
       fi \
    && for locale in  /var/lib/kolla/venv/lib/python3/site-packages/*/locale; do \
           (cd ${locale%/*} && /var/lib/kolla/venv/bin/django-admin compilemessages) \
       done \
    && chmod 644 /usr/local/bin/kolla_extend_start

{{ macros.kolla_patch_sources() }}

{% block horizon_footer %}{% endblock %}
{% block footer %}{% endblock %}