cilium / pwru

Packet, where are you? -- eBPF-based Linux kernel networking debugger
Apache License 2.0
2.84k stars 172 forks source link

Multi-arch container image #262

Open lizrice opened 1 year ago

lizrice commented 1 year ago

The container image is currently x86 only, would be great to have a multi-arch image so people can easily run as a container on ARM platforms as well

lizrice commented 1 year ago

This is not a full solution but maybe points in a useful direction: I was able to make some small changes to the Dockerfile to get a multi-arch image that works on my ARM Mac at least.

FROM --platform=$TARGETPLATFORM ubuntu:22.04 AS build
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH
ARG BUILDARCH
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" > /log

ENV PATH $PATH:/usr/local/go/bin

RUN apt update -y -q && \
    DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y -q \
        curl \
        build-essential \
        ca-certificates \
        wget \
        gnupg2 \
        git \
        llvm \
        clang \
        gcc flex bison gcc-aarch64* libc6-dev-arm64-cross
RUN curl -s https://storage.googleapis.com/golang/go1.20.5.linux-$TARGETARCH.tar.gz | tar -v -C /usr/local -xz

WORKDIR /pwru
COPY . .
RUN TARGET_GOARCH=${TARGETARCH} GOARCH=${BUILDARCH} make 
RUN chmod a+x /pwru

FROM --platform=$TARGETPLATFORM busybox
COPY --from=build /pwru/pwru /usr/local/bin/

Using a Docker container driver I can locally build and push a multi-arch image like this: docker buildx build --platform linux/amd64,linux/arm64 --tag <owner>/pwru --push . (kinda slowly due to QEMU). But I couldn't quickly see a script or action or something that could be updated to run this build

mstrYoda commented 7 months ago

Are there any progress on here? Would love to see official arm64 image.

Btw @lizrice, I needed to change https://storage.googleapis.com/golang/go1.20.5.linux-$TARGETARCH to https://storage.googleapis.com/golang/go1.21.0.linux-$TARGETARCH otherwise I got error about go toolchain (go.mod line 3).

brb commented 7 months ago

Thanks for asking, but unfortunately no progress. We would love to see a contribution for it.