forked from bpfman/bpfman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Containerfile.bpfman.multi.arch
48 lines (39 loc) · 1.93 KB
/
Containerfile.bpfman.multi.arch
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
# We do not use --platform feature to auto fill this ARG because of incompatibility between podman and docker
ARG BUILDPLATFORM=linux/amd64
FROM --platform=$BUILDPLATFORM ubuntu:24.04 AS bpfman-build
ARG BUILDPLATFORM
# The following ARGs are set internally by docker/build-push-action in github actions
ARG TARGETPLATFORM
WORKDIR /usr/src/bpfman
COPY ./ /usr/src/bpfman
RUN mkdir -p bin/
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
echo "Building x86" && \
cp target/x86_64-unknown-linux-gnu/release/bpfman bin/. && \
cp target/x86_64-unknown-linux-gnu/release/bpfman-ns bin/. && \
cp target/x86_64-unknown-linux-gnu/release/bpfman-rpc bin/.; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
echo "Building arm64" && \
cp target/aarch64-unknown-linux-gnu/release/bpfman bin/. && \
cp target/aarch64-unknown-linux-gnu/release/bpfman-ns bin/. && \
cp target/aarch64-unknown-linux-gnu/release/bpfman-rpc bin/.; \
elif [ "$TARGETPLATFORM" = "linux/ppc64le" ]; then \
echo "Building ppc64le" && \
cp target/powerpc64le-unknown-linux-gnu/release/bpfman bin/. && \
cp target/powerpc64le-unknown-linux-gnu/release/bpfman-ns bin/. && \
cp target/powerpc64le-unknown-linux-gnu/release/bpfman-rpc bin/.; \
elif [ "$TARGETPLATFORM" = "linux/s390x" ]; then \
echo "Building s390x" && \
cp target/s390x-unknown-linux-gnu/release/bpfman bin/. && \
cp target/s390x-unknown-linux-gnu/release/bpfman-ns bin/. && \
cp target/s390x-unknown-linux-gnu/release/bpfman-rpc bin/.; \
fi
FROM ubuntu:24.04
RUN apt-get update && \
apt-get -y install ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/\* /tmp/\* /var/tmp/*
COPY --from=bpfman-build /usr/src/bpfman/bin/bpfman .
COPY --from=bpfman-build /usr/src/bpfman/bin/bpfman-ns .
COPY --from=bpfman-build /usr/src/bpfman/bin/bpfman-rpc .
ENTRYPOINT ["./bpfman-rpc", "--timeout=0"]