11# Build the manager binary
22ARG BUILDPLATFORM
33
4- FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22 AS bpfman-agent-build
4+ FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.23 AS bpfman-agent-build
55
66# The following ARGs are set internally by docker/build-push-action in github actions
77ARG TARGETOS
@@ -24,10 +24,30 @@ COPY . .
2424# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
2525RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -mod vendor -o bpfman-agent ./cmd/bpfman-agent/main.go
2626
27+
28+ FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.23 AS cri-tools-build
29+ # The following ARGs are set internally by docker/build-push-action in github actions
30+ ARG TARGETOS
31+ ARG TARGETARCH
32+ ARG TARGETPLATFORM
33+
34+ ARG BUILDPLATFORM
35+
36+ RUN echo "TARGETOS=${TARGETOS} TARGETARCH=${TARGETARCH} BUILDPLATFORM=${BUILDPLATFORM} TARGETPLATFORM=${TARGETPLATFORM}"
37+
38+ WORKDIR /usr/src/cri-tools
39+ ARG CRI_REPO_URL=https://github.com/kubernetes-sigs/cri-tools
40+ ARG CRI_REPO_BRANCH=master
41+
42+ RUN git clone --depth 1 --branch $CRI_REPO_BRANCH $CRI_REPO_URL .
43+
44+ # Build
45+ RUN GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} VERSION="latest" make
46+ RUN cp ./build/bin/${TARGETOS}/${TARGETARCH}/crictl .
47+
2748# Use the fedora minimal image to reduce the size of the final image but still
2849# be able to easily install extra packages.
2950FROM --platform=$TARGETPLATFORM quay.io/fedora/fedora-minimal
30- ARG DNF_CMD="microdnf"
3151
3252# The full fedora image can be used for debugging purposes. To use it, comment
3353# out the FROM and ARG lines above and uncomment the FROM and ARG lines below.
@@ -41,11 +61,7 @@ WORKDIR /
4161COPY --from=bpfman-agent-build /usr/src/bpfman-operator/bpfman-agent .
4262
4363# Install crictl
44- RUN ${DNF_CMD} -y install wget tar gzip ca-certificates
45- ARG VERSION="v1.31.0"
46- RUN wget https://github.com/kubernetes-sigs/cri-tools/releases/download/${VERSION}/crictl-${VERSION}-linux-${TARGETARCH}.tar.gz
47- RUN tar zxvf crictl-${VERSION}-linux-${TARGETARCH}.tar.gz -C /usr/local/bin
48- RUN rm -f crictl-${VERSION}-linux-${TARGETARCH}.tar.gz
49- RUN ${DNF_CMD} -y clean all
64+ COPY --from=cri-tools-build /usr/src/cri-tools/crictl /usr/local/bin
65+ RUN chmod +x /usr/local/bin/crictl
5066
5167ENTRYPOINT ["/bpfman-agent"]
0 commit comments