Kolla provides production-ready containers and deployment tools for operating OpenStack clouds
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
6.1KB

  1. FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
  2. LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
  3. {% block horizon_header %}{% endblock %}
  4. {% import "macros.j2" as macros with context %}
  5. {{ macros.configure_user(name='horizon') }}
  6. {% if install_type == 'binary' %}
  7. {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
  8. {% set horizon_packages = [
  9. 'gettext',
  10. 'httpd',
  11. 'mod_ssl',
  12. 'mod_wsgi',
  13. 'openstack-cloudkitty-ui',
  14. 'openstack-dashboard',
  15. 'openstack-designate-ui',
  16. 'openstack-heat-ui',
  17. 'openstack-ironic-ui',
  18. 'openstack-magnum-ui',
  19. 'openstack-manila-ui',
  20. 'openstack-mistral-ui',
  21. 'openstack-murano-ui',
  22. 'openstack-neutron-lbaas-ui',
  23. 'openstack-octavia-ui',
  24. 'openstack-sahara-ui',
  25. 'openstack-trove-ui',
  26. 'openstack-vitrage-ui'
  27. ] %}
  28. {{ macros.install_packages(horizon_packages | customizable("packages")) }}
  29. {% block horizon_redhat_binary_setup %}
  30. RUN sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf \
  31. && sed -i -r 's,^(Listen 443),#\1,' /etc/httpd/conf.d/ssl.conf \
  32. && ln -s /usr/share/openstack-dashboard/openstack_dashboard /usr/lib/python2.7/site-packages/openstack_dashboard \
  33. && ln -s /usr/share/openstack-dashboard/static /usr/lib/python2.7/site-packages/static \
  34. && chown -R horizon: /etc/openstack-dashboard /usr/share/openstack-dashboard \
  35. && chown -R apache: /usr/share/openstack-dashboard/static \
  36. && sed -i "s|WEBROOT = '/dashboard/'|WEBROOT = '/'|" /etc/openstack-dashboard/local_settings \
  37. && cp /usr/share/openstack-dashboard/manage.py /usr/bin/manage.py \
  38. && rm -f /usr/share/openstack-dashboard/openstack_dashboard/local/enabled/?[^_]*.py* \
  39. && rm -f /usr/lib/python2.7/site-packages/openstack_dashboard/local/enabled/?[^_]*.py* \
  40. && for locale in /usr/lib/python2.7/site-packages/*/locale; do \
  41. (cd ${locale%/*} && /usr/bin/python /usr/bin/manage.py compilemessages) \
  42. done
  43. {% endblock %}
  44. {% elif base_distro in ['debian', 'ubuntu'] %}
  45. {% set horizon_packages = [
  46. 'apache2',
  47. 'gettext',
  48. 'libapache2-mod-wsgi',
  49. 'locales',
  50. 'openstack-dashboard',
  51. 'python-designate-dashboard',
  52. 'python-heat-dashboard',
  53. 'python-manila-ui',
  54. 'python-murano-dashboard',
  55. 'python-neutron-lbaas-dashboard',
  56. 'python-sahara-dashboard',
  57. 'python-trove-dashboard',
  58. 'tzdata'
  59. ] %}
  60. {{ macros.install_packages(horizon_packages | customizable("packages")) }}
  61. {% block horizon_ubuntu_binary_setup %}
  62. RUN echo > /etc/apache2/ports.conf \
  63. && sed -i 's|\(ServerTokens \)OS|\1Prod|' /etc/apache2/conf-available/security.conf \
  64. && ln -s ../mods-available/headers.load /etc/apache2/mods-enabled/headers.load \
  65. && ln -s ../mods-available/expires.load /etc/apache2/mods-enabled/expires.load \
  66. && cp /usr/share/openstack-dashboard/openstack_dashboard/conf/*.json /etc/openstack-dashboard \
  67. && cp /usr/share/openstack-dashboard/manage.py /usr/bin/manage.py \
  68. && rm /etc/apache2/conf-enabled/openstack-dashboard.conf \
  69. && rm /etc/openstack-dashboard/local_settings.py \
  70. && ln -s /etc/openstack-dashboard/local_settings /etc/openstack-dashboard/local_settings.py \
  71. && for locale in /usr/lib/python2.7/site-packages/*/locale; do \
  72. (cd ${locale%/*} && /usr/bin/python /usr/bin/manage.py compilemessages) \
  73. done
  74. {% endblock %}
  75. {% endif %}
  76. {% elif install_type == 'source' %}
  77. {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
  78. {% set horizon_packages = [
  79. 'gettext',
  80. 'httpd',
  81. 'mod_ssl',
  82. 'mod_wsgi'
  83. ] %}
  84. {{ macros.install_packages(horizon_packages | customizable("packages")) }}
  85. {% block horizon_redhat_source_setup %}
  86. RUN sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf \
  87. && sed -i -r 's,^(Listen 443),#\1,' /etc/httpd/conf.d/ssl.conf
  88. {% endblock %}
  89. {% elif base_distro in ['debian', 'ubuntu'] %}
  90. {% set horizon_packages = [
  91. 'apache2',
  92. 'gettext',
  93. 'libapache2-mod-wsgi',
  94. 'locales',
  95. 'tzdata'
  96. ] %}
  97. {{ macros.install_packages(horizon_packages | customizable("packages")) }}
  98. {% block horizon_ubuntu_source_setup %}
  99. RUN echo > /etc/apache2/ports.conf \
  100. && ln -s ../mods-available/headers.load /etc/apache2/mods-enabled/headers.load
  101. {% endblock %}
  102. {% endif %}
  103. ADD horizon-archive /horizon-source
  104. ADD plugins-archive /
  105. {% set horizon_pip_packages = [
  106. '/horizon'
  107. ] %}
  108. {% set horizon_plugins_pip_packages = [
  109. '/plugins/*'
  110. ] %}
  111. # NOTE(hrw): to install horizon from unpacked sources we cannot have it in upper-constraints.txt
  112. RUN ln -s horizon-source/* horizon \
  113. && sed -i /^horizon=/d /requirements/upper-constraints.txt \
  114. && {{ macros.install_pip(horizon_pip_packages | customizable("pip_packages")) }} \
  115. && mkdir -p /etc/openstack-dashboard \
  116. && cp -r /horizon/openstack_dashboard/conf/* /etc/openstack-dashboard/ \
  117. && cp /horizon/openstack_dashboard/local/local_settings.py.example /etc/openstack-dashboard/local_settings \
  118. && cp /horizon/manage.py /var/lib/kolla/venv/bin/manage.py \
  119. && if [ "$(ls /plugins)" ]; then \
  120. {{ macros.install_pip(horizon_plugins_pip_packages) }}; \
  121. fi \
  122. && for locale in /var/lib/kolla/venv/lib/python2.7/site-packages/*/locale; do \
  123. (cd ${locale%/*} && /var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py compilemessages) \
  124. done \
  125. && chown -R horizon: /etc/openstack-dashboard /var/lib/kolla/venv/lib/python2.7/site-packages/static
  126. {% endif %}
  127. COPY extend_start.sh /usr/local/bin/kolla_extend_start
  128. RUN chmod 755 /usr/local/bin/kolla_extend_start
  129. {% block horizon_footer %}{% endblock %}
  130. {% block footer %}{% endblock %}