Skip to content

Commit

Permalink
pkg/bpftrace: push empty image to dockerhub
Browse files Browse the repository at this point in the history
this way we can work around the fact that get-deps does
not build dependencies architecture specific and therefore
tries to build bpftrace for riscv64
with this change an empty image will be pulled and put into
the debug container on riscv64

other architectures stay the same as before

Signed-off-by: Christoph Ostarek <christoph@zededa.com>
  • Loading branch information
christoph-zededa committed Jul 8, 2024
1 parent f208c67 commit 263544e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ endif
PKGS_riscv64=pkg/ipxe pkg/mkconf pkg/mkimage-iso-efi pkg/grub \
pkg/mkimage-raw-efi pkg/uefi pkg/u-boot pkg/cross-compilers \
pkg/debug pkg/dom0-ztools pkg/gpt-tools pkg/storage-init pkg/mkrootfs-squash \
pkg/bsp-imx pkg/optee-os pkg/recovertpm
pkg/bsp-imx pkg/optee-os pkg/recovertpm pkg/bpftrace
# alpine-base and alpine must be the first packages to build
PKGS=pkg/alpine $(PKGS_$(ZARCH))
# eve-alpine-base is bootstrap image for eve-alpine
Expand Down
27 changes: 17 additions & 10 deletions pkg/bpftrace/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ WORKDIR /usr/src/bpftrace
RUN for i in patches/*.patch; do git apply "$i"; done
RUN mkdir build
WORKDIR /usr/src/bpftrace/build
RUN cmake ..
RUN cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang ..
RUN make -j "$(getconf _NPROCESSORS_ONLN)"
RUN make DESTDIR="/out/opt/zededa" install
RUN make install
# portability analyser is disabled, therefore skip those tests
# skip file exist test - probably broken because of container

Expand All @@ -30,11 +30,18 @@ RUN if perl -ne 'exit 1 if (m/^bogomips\s*:\s*(\d+)/i && $1 < 500);' /proc/cpuin
fi


FROM scratch
COPY --from=build /out/opt/zededa/usr/local/bin/bpftrace-aotrt /usr/bin/bpftrace-aotrt
COPY --from=build /usr/lib/libbpf.so.0 /usr/lib/libbpf.so.0
COPY --from=build /usr/lib/libelf.so.1 /usr/lib/libelf.so.1
COPY --from=build /lib/libz.so.1 /lib/libz.so.1
COPY --from=build /usr/lib/libbcc_bpf.so.0 /usr/lib/libbcc_bpf.so.0
COPY --from=build /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6
COPY --from=build /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1
RUN mkdir -vp /bpftrace/usr/bin /bpftrace/usr/lib /bpftrace/lib
RUN cp -v /usr/bin/bpftrace-aotrt /bpftrace/usr/bin/bpftrace-aotrt
RUN cp -v /usr/lib/libbpf.so.0 /bpftrace/usr/lib/libbpf.so.0
RUN cp -v /usr/lib/libelf.so.1 /bpftrace/usr/lib/libelf.so.1
RUN cp -v /lib/libz.so.1 /bpftrace/lib/libz.so.1
RUN cp -v /usr/lib/libbcc_bpf.so.0 /bpftrace/usr/lib/libbcc_bpf.so.0
RUN cp -v /usr/lib/libstdc++.so.6 /bpftrace/usr/lib/libstdc++.so.6
RUN cp -v /usr/lib/libgcc_s.so.1 /bpftrace/usr/lib/libgcc_s.so.1

FROM build AS build-amd64
FROM build AS build-arm64
FROM scratch AS build-riscv64

# hadolint ignore=DL3006
FROM build-${TARGETARCH} AS bpftrace

0 comments on commit 263544e

Please sign in to comment.