kolla/docker/swift/swift-base/Dockerfile.j2
Chao Guo 961224c6cf Use install-pip macro in most source images
1. Enable customization of pip packages in source
branch of most images
2. All pip packages install uniformly through
install-pip macro, user can easily customize his
own pip command (For example using a mirror)

Co-Authored-By: Mauricio Lima <mauriciolimab@gmail.com>
Change-Id: If09582039f690fa4136e8f33200d5da15e092da7
2017-02-17 08:49:32 -03:00

59 lines
2.0 KiB
Django/Jinja

FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
MAINTAINER {{ maintainer }}
{% block swift_base_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='swift') }}
{% if install_type == 'binary' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set swift_base_packages = [
'openstack-swift'
]
%}
{% elif base_distro in ['ubuntu'] %}
{% set swift_base_packages = [
'swift'
]
%}
{% endif %}
{{ macros.install_packages(swift_base_packages | customizable("packages")) }}
{% elif install_type == 'source' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set swift_base_packages = ['liberasurecode-devel'] %}
{% elif base_distro in ['ubuntu', 'debian'] %}
{% set swift_base_packages = ['liberasurecode-dev'] %}
{% endif %}
{{ macros.install_packages(swift_base_packages | customizable("packages")) }}
ADD swift-base-archive /swift-base-source
{% set swift_base_pip_packages = [
'/swift'
] %}
RUN ln -s swift-base-source/* swift \
&& {{ macros.install_pip(swift_base_pip_packages | customizable("pip_packages")) }} \
&& mkdir -p /etc/swift /var/cache/swift \
&& cp -r /swift/etc/* /etc/swift/ \
&& chown -R swift: /etc/swift /var/cache/swift
{% endif %}
COPY swift-rootwrap /var/lib/kolla/venv/bin/swift-rootwrap
COPY rootwrap.conf /etc/swift/rootwrap.conf
COPY swift_sudoers /etc/sudoers.d/kolla_swift_sudoers
COPY build-swift-ring.py /usr/local/bin/kolla_build_swift_ring
RUN chmod 755 /var/lib/kolla/venv/bin/swift-rootwrap \
&& chmod 644 /etc/swift/rootwrap.conf \
&& sed -i 's|^exec_dirs.*|exec_dirs=/var/lib/kolla/venv/bin,/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin|g' /etc/swift/rootwrap.conf \
&& chmod 750 /etc/sudoers.d \
&& chmod 440 /etc/sudoers.d/kolla_swift_sudoers \
&& mkdir -p /opt/swift
{% block swift_base_footer %}{% endblock %}