@@ -17,16 +17,22 @@ ARG LIBNFTNL_VER=1.2.2-1
17
17
ARG IPSET_VER=7.11-6
18
18
ARG RUNIT_VER=2.1.2
19
19
ARG BIRD_IMAGE=calico/bird:latest
20
+ ARG QEMU_IMAGE
20
21
ARG UBI_IMAGE
21
22
22
23
FROM calico/bpftool:v5.3-arm64 as bpftool
24
+ FROM ${QEMU_IMAGE} as qemu
23
25
FROM ${BIRD_IMAGE} as bird
24
26
25
27
# Use this build stage to build iptables rpm and runit binaries.
26
28
# We need to rebuild the iptables rpm because the prepackaged rpm does not have legacy iptables binaries.
27
29
# We need to build runit because there aren't any rpms for it in CentOS or ubi repositories.
28
30
FROM quay.io/centos/centos:stream8 as centos
29
31
32
+ # Enable non-native builds of this image on an amd64 hosts.
33
+ # This must be the first RUN command in this file!
34
+ COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
35
+
30
36
ARG IPTABLES_VER
31
37
ARG LIBNFTNL_VER
32
38
ARG IPSET_VER
@@ -75,11 +81,9 @@ RUN rpm -i ${IPSET_SOURCERPM_URL} && \
75
81
76
82
# runit is not available in ubi or CentOS repos so build it.
77
83
# get it from the debian repos as the official website doesn't support https
78
- RUN wget -P /tmp https://ftp.debian.org/debian/pool/main/r/runit/runit_${RUNIT_VER}.orig.tar.gz && \
79
- gunzip /tmp/runit_${RUNIT_VER}.orig.tar.gz && \
80
- tar -xpf /tmp/runit_${RUNIT_VER}.orig.tar -C /tmp && \
81
- cd /tmp/admin/runit-${RUNIT_VER}/ && \
82
- package/install
84
+ RUN curl -sfL https://ftp.debian.org/debian/pool/main/r/runit/runit_${RUNIT_VER}.orig.tar.gz | tar xz -C /root && \
85
+ cd /root/admin/runit-${RUNIT_VER} && \
86
+ package/compile
83
87
84
88
FROM ${UBI_IMAGE} as ubi
85
89
@@ -89,11 +93,15 @@ ARG LIBNFTNL_VER
89
93
ARG IPSET_VER
90
94
ARG RUNIT_VER
91
95
96
+ # Enable non-native builds of this image on an amd64 hosts.
97
+ # This must be the first RUN command in this file!
98
+ COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
99
+
92
100
# Update base packages to pick up security updates. Must do this before adding the centos repo.
93
101
RUN microdnf upgrade
94
102
95
103
# Copy in runit binaries
96
- COPY --from=centos /tmp /admin/runit-${RUNIT_VER}/command/* /usr/local/bin/
104
+ COPY --from=centos /root /admin/runit-${RUNIT_VER}/command/* /usr/local/bin/
97
105
98
106
# Copy in our rpms
99
107
COPY --from=centos /root/rpmbuild/RPMS/aarch64/* /tmp/rpms/
@@ -203,8 +211,13 @@ RUN chmod u+s /bin/mountns
203
211
# Clean out as many files as we can from the filesystem. We no longer need dnf or the platform python install
204
212
# or any of its dependencies.
205
213
COPY clean-up-filesystem.sh /clean-up-filesystem.sh
214
+ # Allowing qemu binaries to persist.
215
+ RUN sed -i 's#zmore#zmore\n\tqemu\n#m' /clean-up-filesystem.sh
206
216
RUN /clean-up-filesystem.sh
207
217
218
+ # Delete qemu binaries
219
+ RUN rm /usr/bin/qemu-aarch64-static
220
+
208
221
# Add in top-level license file
209
222
COPY LICENSE /licenses/LICENSE
210
223
0 commit comments