aboutsummaryrefslogtreecommitdiff
path: root/docker/swift/swift-base/Dockerfile.j2
blob: 69a8a4068b0d68136ec1cd3769d0205df2f0480b (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
FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
MAINTAINER {{ maintainer }}

{% block swift_base_header %}{% endblock %}

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

{% 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
RUN ln -s swift-base-source/* swift \
    && useradd --user-group swift \
    && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /swift \
    && mkdir -p /etc/swift /var/cache/swift /var/log/swift /home/swift \
    && cp -r /swift/etc/* /etc/swift/ \
    && chown -R swift: /etc/swift /var/cache/swift /var/log/swift /home/swift

{% endif %}

RUN pip install oslo.rootwrap

COPY swift-rootwrap /var/lib/kolla/venv/bin/swift-rootwrap
COPY rootwrap.conf /etc/swift/rootwrap.conf
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

COPY swift_sudoers /etc/sudoers.d/kolla_swift_sudoers
RUN chmod 750 /etc/sudoers.d \
    && chmod 440 /etc/sudoers.d/kolla_swift_sudoers

COPY build-swift-ring.py /usr/local/bin/kolla_build_swift_ring
RUN mkdir -p /opt/swift

RUN usermod -a -G kolla swift

{% block swift_base_footer %}{% endblock %}
{% block footer %}{% endblock %}