Skip to content

Commit

Permalink
Merge pull request #2430 from linux-on-ibm-z/s390x-support
Browse files Browse the repository at this point in the history
Update Dockerfile.s390x
  • Loading branch information
fasaxc authored Aug 3, 2020
2 parents 3c13a86 + b8309ff commit 4d3e359
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions docker-image/Dockerfile.s390x
Original file line number Diff line number Diff line change
@@ -1,44 +1,16 @@
ARG QEMU_IMAGE=calico/go-build:latest
FROM ${QEMU_IMAGE} as qemu

FROM s390x/debian:buster-slim as bpftool-build

COPY --from=qemu /usr/bin/qemu-s390x-static /usr/bin/

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
gpg gpg-agent libelf-dev libmnl-dev libc-dev iptables libgcc-8-dev \
bash-completion binutils binutils-dev ca-certificates make git curl \
xz-utils gcc pkg-config bison flex build-essential && \
apt-get purge --auto-remove && \
apt-get clean

WORKDIR /tmp

RUN \
git clone --depth 1 -b master git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git && \
cd linux/tools/bpf/bpftool/ && \
sed -i '/CFLAGS += -O2/a CFLAGS += -static' Makefile && \
sed -i 's/LIBS = -lelf $(LIBBPF)/LIBS = -lelf -lz $(LIBBPF)/g' Makefile && \
printf 'feature-libbfd=0\nfeature-libelf=1\nfeature-bpf=1\nfeature-libelf-mmap=1' >> FEATURES_DUMP.bpftool && \
FEATURES_DUMP=`pwd`/FEATURES_DUMP.bpftool make -j `getconf _NPROCESSORS_ONLN` && \
strip bpftool && \
ldd bpftool 2>&1 | grep -q -e "Not a valid dynamic program" \
-e "not a dynamic executable" || \
( echo "Error: bpftool is not statically linked"; false ) && \
mv bpftool /usr/bin && rm -rf /tmp/linux
FROM calico/bpftool:v5.3-s390x as bpftool

FROM s390x/alpine:3.8 as base
MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/community/groups/community/lozopensource)

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


# Install our dependencies.
RUN apk --no-cache add ip6tables tini ipset iputils iproute2 conntrack-tools file

Expand All @@ -49,7 +21,7 @@ ADD calico-felix-wrapper /usr/bin
# to more easily extract the Felix build artefacts from the container.
ADD bin/calico-felix-s390x /code/calico-felix
RUN ln -s /code/calico-felix /usr/bin
COPY --from=bpftool-build /usr/bin/bpftool /usr/bin
COPY --from=bpftool /bpftool /usr/bin
WORKDIR /code

# Since our binary isn't designed to run as PID 1, run it via the tini init daemon.
Expand Down

0 comments on commit 4d3e359

Please sign in to comment.