Skip to content

Commit 5f808f9

Browse files
authored
Merge pull request #8806 from projectcalico/node-arm64-emulated-build
Add qemu emulated arm64 node image build
2 parents 6ad14f8 + 407509a commit 5f808f9

File tree

4 files changed

+28
-17
lines changed

4 files changed

+28
-17
lines changed

node/Dockerfile.amd64

+4-6
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ RUN rpm -i ${IPSET_SOURCERPM_URL} && \
7575

7676
# runit is not available in ubi or CentOS repos so build it.
7777
# 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
78+
RUN curl -sfL https://ftp.debian.org/debian/pool/main/r/runit/runit_${RUNIT_VER}.orig.tar.gz | tar xz -C /root && \
79+
cd /root/admin/runit-${RUNIT_VER} && \
80+
package/compile
8381

8482
FROM ${UBI_IMAGE} as ubi
8583

@@ -93,7 +91,7 @@ ARG RUNIT_VER
9391
RUN microdnf upgrade
9492

9593
# Copy in runit binaries
96-
COPY --from=centos /tmp/admin/runit-${RUNIT_VER}/command/* /usr/local/bin/
94+
COPY --from=centos /root/admin/runit-${RUNIT_VER}/command/* /usr/local/bin/
9795

9896
# Copy in our rpms
9997
COPY --from=centos /root/rpmbuild/RPMS/x86_64/* /tmp/rpms/

node/Dockerfile.arm64

+19-6
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,22 @@ ARG LIBNFTNL_VER=1.2.2-1
1717
ARG IPSET_VER=7.11-6
1818
ARG RUNIT_VER=2.1.2
1919
ARG BIRD_IMAGE=calico/bird:latest
20+
ARG QEMU_IMAGE
2021
ARG UBI_IMAGE
2122

2223
FROM calico/bpftool:v5.3-arm64 as bpftool
24+
FROM ${QEMU_IMAGE} as qemu
2325
FROM ${BIRD_IMAGE} as bird
2426

2527
# Use this build stage to build iptables rpm and runit binaries.
2628
# We need to rebuild the iptables rpm because the prepackaged rpm does not have legacy iptables binaries.
2729
# We need to build runit because there aren't any rpms for it in CentOS or ubi repositories.
2830
FROM quay.io/centos/centos:stream8 as centos
2931

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+
3036
ARG IPTABLES_VER
3137
ARG LIBNFTNL_VER
3238
ARG IPSET_VER
@@ -75,11 +81,9 @@ RUN rpm -i ${IPSET_SOURCERPM_URL} && \
7581

7682
# runit is not available in ubi or CentOS repos so build it.
7783
# 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
8387

8488
FROM ${UBI_IMAGE} as ubi
8589

@@ -89,11 +93,15 @@ ARG LIBNFTNL_VER
8993
ARG IPSET_VER
9094
ARG RUNIT_VER
9195

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+
92100
# Update base packages to pick up security updates. Must do this before adding the centos repo.
93101
RUN microdnf upgrade
94102

95103
# 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/
97105

98106
# Copy in our rpms
99107
COPY --from=centos /root/rpmbuild/RPMS/aarch64/* /tmp/rpms/
@@ -203,8 +211,13 @@ RUN chmod u+s /bin/mountns
203211
# Clean out as many files as we can from the filesystem. We no longer need dnf or the platform python install
204212
# or any of its dependencies.
205213
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
206216
RUN /clean-up-filesystem.sh
207217

218+
# Delete qemu binaries
219+
RUN rm /usr/bin/qemu-aarch64-static
220+
208221
# Add in top-level license file
209222
COPY LICENSE /licenses/LICENSE
210223

node/Dockerfile.ppc64le

+2-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ LABEL version=${GIT_VERSION}
4242

4343
# Enable non-native builds of this image on an amd64 hosts.
4444
# This must be the first RUN command in this file!
45-
# we only need this for the intermediate "base" image, so we can run all the apk and other commands
46-
# when running on a kernel >= 4.8, this will become less relevant
47-
COPY --from=qemu /usr/bin/qemu-${ARCH}-static /usr/bin/
45+
COPY --from=qemu /usr/bin/qemu-ppc64le-static /usr/bin/qemu-ppc64le-static
4846

4947
# Install remaining runtime deps required for felix from the global repository
5048
RUN apk add --no-cache bash ip6tables ipset iputils iproute2 conntrack-tools runit file ca-certificates
@@ -69,6 +67,6 @@ RUN chmod u+s /bin/mountns
6967

7068
COPY --from=bpftool /bpftool /bin
7169

72-
RUN rm /usr/bin/qemu-${ARCH}-static
70+
RUN rm /usr/bin/qemu-ppc64le-static
7371

7472
CMD ["start_runit"]

node/Dockerfile.s390x

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ LABEL version=${GIT_VERSION}
3939

4040
# Enable non-native builds of this image on an amd64 hosts.
4141
# This must be the first RUN command in this file!
42-
COPY --from=qemu /usr/bin/qemu-*-static /usr/bin/
42+
COPY --from=qemu /usr/bin/qemu-s390x-static /usr/bin/qemu-s390x-static
4343

4444
# Install remaining runtime deps required for felix from the global repository
4545
RUN apk add --no-cache bash ip6tables ipset iputils iproute2 conntrack-tools runit file ca-certificates
@@ -67,4 +67,6 @@ COPY --from=bpftool /bpftool /bin
6767
# Add in top-level license file
6868
COPY LICENSE /licenses
6969

70+
RUN rm /usr/bin/qemu-s390x-static
71+
7072
CMD ["start_runit"]

0 commit comments

Comments
 (0)