summaryrefslogtreecommitdiff
path: root/docker/bifrost/bifrost-base/Dockerfile.j2
blob: 6b9f5f4d422537a4eef1cf4de55f4aff21334cb2 (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
FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"

{% block bifrost_base_header %}{% endblock %}

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

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

{% if install_type == 'binary' %}

RUN echo '{{ install_type }} not yet available for {{ base_distro }}' && /bin/false

{% elif install_type == 'source' %}

ENV VENV /var/lib/kolla/venv

{% set bifrost_base_pip_packages = [
    '/bifrost'
] %}

ADD bifrost-base-archive /bifrost-base-source
COPY build_arg.yml /tmp/build_arg.yml
RUN ln -s bifrost-base-source/* bifrost \
    && {{ macros.install_pip(bifrost_base_pip_packages | customizable("pip_packages")) }}

WORKDIR /bifrost

{% if base_package_type == 'rpm' %}
{# Remove updated RabbitMQ packages since these are not supported by Bifrost yet. #}
RUN rm -f /etc/yum.repos.d/rabbitmq_rabbitmq-server.repo \
    && yum clean all &&  rm -rf /var/yum/cache
{% elif base_package_type == 'deb' %}
RUN sed -e "s/.*mariadb.*//Ig" -e "s/.*rabbitmq.*//Ig" -i /etc/apt/sources.list \
    && apt-get purge -y mariadb* mysql*
{% endif %}

{# ANSIBLE_GATHER_TIMEOUT is a workaround for https://github.com/ansible/ansible/issues/43884 #}
ENV ANSIBLE_GATHER_TIMEOUT=30

{% block bifrost_ansible_install %}
{% if base_package_type == 'deb' %}
RUN apt-get update && \
{% else %}
RUN echo " " && \
{% endif %}
    bash -c './scripts/env-setup.sh && source ./env-vars && \
    ansible-playbook -vvvv -i /bifrost/playbooks/inventory/target /bifrost/playbooks/install.yaml \
    -e @/tmp/build_arg.yml && \
{% if base_package_type == 'deb' %}
    apt-get clean && rm -rf /var/lib/apt/lists/*'
{% else %}
    yum clean all && rm -rf /var/yum/cache'
{% endif %}
{% endblock %}
{% endif %}

COPY bifrost_sudoers /etc/sudoers.d/kolla_bifrost_sudoers

RUN chmod 750 /etc/sudoers.d \
    && chmod 440 /etc/sudoers.d/kolla_bifrost_sudoers \
    && chown -R bifrost:bifrost /bifrost

{% block bifrost_base_footer %}{% endblock %}