File tree Expand file tree Collapse file tree 4 files changed +15
-15
lines changed Expand file tree Collapse file tree 4 files changed +15
-15
lines changed Original file line number Diff line number Diff line change 1818 - name : Checkout
1919 uses : actions/checkout@v4
2020
21- - name : Set up QEMU
22- uses : docker/setup-qemu-action@v3
23-
2421 - name : Set up Docker Buildx
2522 uses : docker/setup-buildx-action@v3
2623
2926
3027 - name : Compute checksum for each binary
3128 run : |
32- arch=("amd64" "arm64" "arm")
29+ arch=("amd64" "arm64" "arm" "riscv64" )
3330 cd dist/artifacts
3431 for a in "${arch[@]}"; do
3532 sha256sum kine-"${a}" > sha256sum-"${a}".txt
Original file line number Diff line number Diff line change @@ -53,16 +53,21 @@ EXPOSE 2379/tcp
5353USER nobody
5454ENTRYPOINT ["/bin/kine" ]
5555
56+ FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
57+
5658FROM --platform=$BUILDPLATFORM golang:1.24-alpine3.20 AS multi-arch-build
57- RUN apk -U add bash coreutils git gcc musl-dev vim less curl wget ca-certificates
59+ COPY --from=xx / /
60+ ARG TARGETOS
61+ ARG TARGETARCH
62+ ENV CGO_ENABLED=1
63+ RUN apk -U add bash coreutils git vim less curl wget ca-certificates clang lld
64+ RUN xx-apk add musl-dev gcc
5865# go imports version gopls/v0.15.3
5966# https://github.com/golang/tools/releases/latest
60- RUN go install golang.org/x/tools/cmd/goimports@cd70d50baa6daa949efa12e295e10829f3a7bd46
67+ RUN xx- go install golang.org/x/tools/cmd/goimports@cd70d50baa6daa949efa12e295e10829f3a7bd46
6168RUN rm -rf /go/src /go/pkg
6269ENV SRC_DIR=/go/src/github.com/k3s-io/kine
6370WORKDIR ${SRC_DIR}/
64- ARG TARGETOS
65- ARG TARGETARCH
6671COPY ./scripts/buildx ./scripts/version ./scripts/
6772COPY ./go.mod ./go.sum ./main.go ./
6873COPY ./pkg ./pkg
Original file line number Diff line number Diff line change 2424 -f Dockerfile --target=binary --output=. .
2525
2626.PHONY : multi-arch-build
27- PLATFORMS = linux/amd64,linux/arm64,linux/arm/v7
27+ PLATFORMS = linux/amd64,linux/arm64,linux/arm/v7,linux/riscv64
2828multi-arch-build :
2929 docker buildx build --platform=$(PLATFORMS ) --target=multi-arch-binary --output=type=local,dest=bin .
3030 mv bin/linux* /kine* bin/
Original file line number Diff line number Diff line change 11#! /bin/bash
2- # Builds kiune from multiple platforms and os
2+ # Builds kine for multiple platforms and os
33# Intended to be run within a buildx container that provides the --platform flag
4+ # Also needed are the tonistiigi/xx build tools
45set -e
56
67source $( dirname $0 ) /version
@@ -9,9 +10,6 @@ cd $(dirname $0)/..
910
1011mkdir -p bin
1112
12- export GOOS=${TARGETOS}
13- export GOARCH=${TARGETARCH}
14-
1513if [ " $TARGETARCH " = " arm/v7" ]; then
1614 ARCH=" -arm"
1715else
@@ -23,11 +21,11 @@ if [ "$TARGETOS" != "linux" ]; then
2321 OPT_OS=" -${TARGETOS} "
2422fi
2523
26- if [ " $TARGETOS " = " Linux " ]; then
24+ if [ " $TARGETOS " = " linux " ]; then
2725 OTHER_LINKFLAGS=" -extldflags -static -s"
2826fi
2927LINKFLAGS=" -X github.com/k3s-io/kine/pkg/version.Version=$VERSION "
3028LINKFLAGS=" -X github.com/k3s-io/kine/pkg/version.GitCommit=$COMMIT $LINKFLAGS "
3129
3230echo Building Mutliplaform Kine
33- CGO_CFLAGS=" -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_USE_ALLOCA=1" go build -ldflags " $LINKFLAGS $OTHER_LINKFLAGS " -tags nats -o bin/kine" ${OPT_OS}${ARCH} "
31+ CGO_CFLAGS=" -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_USE_ALLOCA=1" xx- go build -ldflags " $LINKFLAGS $OTHER_LINKFLAGS " -tags nats -o bin/kine" ${OPT_OS}${ARCH} "
You can’t perform that action at this time.
0 commit comments