-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.j2
52 lines (48 loc) · 2.42 KB
/
Dockerfile.j2
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
#
# Copyright © 2021 Bedag Informatik AG
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM {{ build.image }} AS build
LABEL \{% for tag in _dest['tags']|list %}
"tag.{{ tag }}.repository"="{{ _dest['namespace'] }}/{{ _dest['name'] }}" \
"tag.{{ tag }}.source"="{{ _source["name"] }}:{{ _source["tag"] }}" \
"tag.{{ tag }}.git.repo"="{{ git_repo }}" \
"tag.{{ tag }}.git.ref"="{{ git_ref }}" \
"tag.{{ tag }}.git.commit"="{{ git_commit }}" \
{%- endfor %}
"maintainer"="{{ maintainer }}"
RUN apt update && apt install python3-venv gcc libpython3-dev git iproute2 -y \
&& git clone -b {{ major }}.{{ minor }}.{{ patch }} https://github.com/Exa-Networks/exabgp.git /app \
&& cd /app \
&& python3 -m venv /venv \
&& mkdir -p /venv/run/exabgp \
&& chown nobody: /venv/run \
&& /venv/bin/pip install --force-reinstall --no-cache-dir --compile ./ \
&& /venv/bin/python3 /venv/bin/exabgp --fi > /venv/etc/exabgp/exabgp.env \
&& mkfifo //venv/run/exabgp/exabgp.in && mkfifo //venv/run/exabgp/exabgp.out \
&& chown nobody: /sbin/ip
USER nobody
FROM {{ _source["name"] }}:{{ _source["tag"] }}
COPY --from=build /venv /venv
COPY --from=build /sbin/ip /sbin/ip
COPY --from=build /usr/lib/x86_64-linux-gnu/libbpf.so.0 /usr/lib/x86_64-linux-gnu/libbpf.so.0
COPY --from=build /usr/lib/x86_64-linux-gnu/libelf.so.1 /usr/lib/x86_64-linux-gnu/libelf.so.1
COPY --from=build /usr/lib/x86_64-linux-gnu/libmnl.so.0 /usr/lib/x86_64-linux-gnu/libmnl.so.0
COPY --from=build /usr/lib/x86_64-linux-gnu/libbsd.so.0 /usr/lib/x86_64-linux-gnu/libbsd.so.0
COPY --from=build /lib/x86_64-linux-gnu/libcap.so.2 /lib/x86_64-linux-gnu/libcap.so.2
COPY --from=build /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so.2
COPY --from=build /usr/lib/x86_64-linux-gnu/libmd.so.0 /usr/lib/x86_64-linux-gnu/libmd.so.0
COPY ./examples/ /venv/etc/exabgp/
USER nobody
ENTRYPOINT ["/venv/bin/python3", "/venv/bin/exabgp"]
CMD ["/venv/etc/exabgp/test.conf"]