This repository was archived by the owner on Oct 14, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 22
33# STEP 1: Build kindnetd binary
44FROM --platform=$BUILDPLATFORM golang:1.23 AS builder
5+ ARG TARGETARCH BUILDPLATFORM
56# copy in sources
67WORKDIR /src
78COPY . .
89# build
9- ARG TARGETARCH
1010RUN CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /go/bin/kindnetd ./cmd/kindnetd
1111WORKDIR /src/cmd/cni-kindnet
1212# sqlite requires CGO
13- RUN CGO_ENABLED=1 GOARCH=$TARGETARCH go build -o /go/bin/cni-kindnet .
13+ RUN if [ "$TARGETARCH" = "arm64" ] ; then \
14+ apt-get update && apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu ;\
15+ CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOARCH=$TARGETARCH go build -o /go/bin/cni-kindnet . ;\
16+ else \
17+ CGO_ENABLED=1 GOARCH=$TARGETARCH go build -o /go/bin/cni-kindnet . ;\
18+ fi
1419
1520# STEP 2: Build small image
16- FROM registry.k8s.io/build-image/distroless-iptables:v0.6.5
21+ FROM --platform=${BUILDPLATFORM} registry.k8s.io/build-image/distroless-iptables:v0.6.6
1722COPY --from=builder --chown=root:root /go/bin/kindnetd /bin/kindnetd
1823COPY --from=builder --chown=root:root /go/bin/cni-kindnet /opt/cni/bin/cni-kindnet
1924CMD ["/bin/kindnetd" ]
Original file line number Diff line number Diff line change 2222 hack/lint.sh
2323
2424update :
25- go mod tidy && go mod vendor
25+ go mod tidy
2626
2727# get image name from directory we're building
2828IMAGE_NAME =kindnetd
@@ -32,9 +32,11 @@ REGISTRY?=ghcr.io/aojea
3232TAG? =$(shell echo "$$(date +v%Y%m%d ) -$$(git describe --always --dirty ) ")
3333# the full image tag
3434IMAGE? =$(REGISTRY ) /$(IMAGE_NAME ) :$(TAG )
35-
35+ PLATFORMS? =linux/amd64,linux/arm64
3636# required to enable buildx
3737export DOCKER_CLI_EXPERIMENTAL =enabled
38+
3839image-build :
39- # docker buildx build --platform=${PLATFORMS} $(OUTPUT) --progress=$(PROGRESS) -t ${IMAGE} --pull $(EXTRA_BUILD_OPT) .
40- docker build . -t ${IMAGE} --load
40+ docker buildx build . \
41+ --platform=" ${PLATFORMS} " \
42+ --tag=" ${IMAGE} "
You can’t perform that action at this time.
0 commit comments