
I think this simple change will make it much more readable Change-Id: I369aee3a19d17c134db1d13b94b8c45a44733149
71 lines
2.4 KiB
Django/Jinja
71 lines
2.4 KiB
Django/Jinja
FROM {{ base_image }}:{{ base_distro_tag }}
|
|
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
|
|
|
|
{# NOTE(SamYaple): Avoid uid/gid conflicts by creating each user/group up front. #}
|
|
{# Specifics required such as homedir or shell are configured within the service specific image #}
|
|
{%- for name, user in users | dictsort() %}
|
|
{% if loop.first -%}RUN {% else %} && {% endif -%}
|
|
groupadd --force --gid {{ user.gid }} {{ name }} \
|
|
&& useradd -M --shell /usr/sbin/nologin --uid {{ user.uid }} --gid {{ user.gid }} {{ name }}
|
|
{%- if not loop.last %} \{% endif -%}
|
|
{%- endfor %}
|
|
|
|
LABEL kolla_version="{{ kolla_version }}"
|
|
|
|
{% import "macros.j2" as macros with context %}
|
|
{% block base_header %}{% endblock %}
|
|
|
|
ENV KOLLA_BASE_DISTRO={{ base_distro }} \
|
|
KOLLA_INSTALL_TYPE={{ install_type }} \
|
|
KOLLA_INSTALL_METATYPE={{ install_metatype }}
|
|
|
|
#### Customize PS1 to be used with bash shell
|
|
COPY kolla_bashrc /tmp/
|
|
RUN cat /tmp/kolla_bashrc >> /etc/skel/.bashrc \
|
|
&& cat /tmp/kolla_bashrc >> /root/.bashrc
|
|
|
|
# PS1 var when used /bin/sh shell
|
|
ENV PS1="$(tput bold)($(printenv KOLLA_SERVICE_NAME))$(tput sgr0)[$(id -un)@$(hostname -s) $(pwd)]$ "
|
|
|
|
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] -%}
|
|
{% include 'base/rpm_distros.j2' %}
|
|
{%- elif base_distro in ['debian', 'ubuntu'] -%}
|
|
{% include 'base/apt_distros.j2' %}
|
|
{%- endif %}
|
|
|
|
COPY set_configs.py /usr/local/bin/kolla_set_configs
|
|
COPY start.sh /usr/local/bin/kolla_start
|
|
COPY sudoers /etc/sudoers
|
|
COPY curlrc /root/.curlrc
|
|
|
|
{% block dumb_init_installation %}
|
|
|
|
{% if base_arch == 'x86_64' %}
|
|
|
|
RUN curl -sSL https://github.com/Yelp/dumb-init/releases/download/v1.1.3/dumb-init_1.1.3_amd64 -o /usr/local/bin/dumb-init \
|
|
&& chmod +x /usr/local/bin/dumb-init
|
|
|
|
{% else %}
|
|
|
|
{{ macros.install_packages(base_compiler_packages) }}
|
|
|
|
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
|
|
&& python get-pip.py \
|
|
&& rm get-pip.py \
|
|
&& pip --no-cache-dir install --prefix='/usr/local' dumb-init==1.1.3 \
|
|
&& chmod +x /usr/local/bin/dumb-init
|
|
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
RUN touch /usr/local/bin/kolla_extend_start \
|
|
&& chmod 755 /usr/local/bin/kolla_start /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_set_configs \
|
|
&& chmod 440 /etc/sudoers \
|
|
&& mkdir -p /var/log/kolla \
|
|
&& chown :kolla /var/log/kolla \
|
|
&& chmod 2775 /var/log/kolla \
|
|
&& rm -f /tmp/kolla_bashrc
|
|
|
|
{% block base_footer %}{% endblock %}
|
|
CMD ["kolla_start"]
|