From 8a71d64530843153c790903fbadfd768016575a4 Mon Sep 17 00:00:00 2001 From: Antony Chazapis Date: Wed, 23 Oct 2024 11:14:54 +0300 Subject: [PATCH] Add support for RISC-V Signed-off-by: Antony Chazapis --- .drone.yml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile.dapper | 2 +- package/Dockerfile | 2 +- scripts/package | 6 +++++- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 696a398..6f78945 100644 --- a/.drone.yml +++ b/.drone.yml @@ -131,6 +131,50 @@ volumes: host: path: /var/run/docker.sock +--- +kind: pipeline +name: riscv64 +type: docker + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: rancher/dapper:v0.5.0 + commands: + - dapper ci + volumes: + - name: docker + path: /var/run/docker.sock + +- name: docker-publish + image: plugins/docker + settings: + dockerfile: package/Dockerfile + password: + from_secret: docker_password + repo: "rancher/klipper-helm" + tag: "${DRONE_TAG}-riscv64" + username: + from_secret: docker_username + build_args: + - ARCH=riscv64 + when: + instance: + - drone-publish.k3s.io + ref: + - refs/head/master + - refs/tags/* + event: + - tag + +volumes: +- name: docker + host: + path: /var/run/docker.sock + --- kind: pipeline name: manifest @@ -151,6 +195,7 @@ steps: - linux/amd64 - linux/arm64 - linux/arm + - linux/riscv64 target: "rancher/klipper-helm:${DRONE_TAG}" template: "rancher/klipper-helm:${DRONE_TAG}-ARCH" when: @@ -166,6 +211,7 @@ depends_on: - amd64 - arm64 - arm +- riscv64 ... diff --git a/Dockerfile.dapper b/Dockerfile.dapper index aa7c7b3..246369b 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -4,7 +4,7 @@ ARG DAPPER_HOST_ARCH ENV ARCH $DAPPER_HOST_ARCH RUN apk -U add bash docker-cli docker-cli-buildx git -ENV DAPPER_ENV REPO TAG DRONE_TAG +ENV DAPPER_ENV REPO TAG DRONE_TAG ARCH ENV DAPPER_SOURCE /go/src/github.com/k3s-io/klipper-helm/ ENV DAPPER_OUTPUT ./bin ./dist ENV DAPPER_DOCKER_SOCKET true diff --git a/package/Dockerfile b/package/Dockerfile index a5bbe15..9ddac38 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -5,7 +5,7 @@ RUN curl -sL https://get.helm.sh/helm-v3.16.1-linux-${ARCH}.tar.gz | tar xvzf - COPY entry /usr/bin/ FROM golang:1.23-alpine3.20 as plugins -RUN apk add -U curl ca-certificates build-base binutils-gold +RUN apk add -U curl ca-certificates build-base ARG ARCH COPY --from=extract /usr/bin/helm /usr/bin/helm RUN mkdir -p /go/src/github.com/k3s-io/helm-set-status && \ diff --git a/scripts/package b/scripts/package index 26f5b54..2a3eb80 100755 --- a/scripts/package +++ b/scripts/package @@ -21,5 +21,9 @@ if [ -e ${DOCKERFILE}.${ARCH} ]; then DOCKERFILE=${DOCKERFILE}.${ARCH} fi -docker build --build-arg ARCH=${ARCH} --build-arg BUILDDATE=$(date +%Y%m%d) -f ${DOCKERFILE} -t ${IMAGE} . +if [ "$ARCH" = "riscv64" ]; then + export DOCKER_BUILDKIT=1 + DOCKER_ARGS="--platform=$ARCH" +fi +docker build ${DOCKER_ARGS} --build-arg ARCH=${ARCH} --build-arg BUILDDATE=$(date +%Y%m%d) -f ${DOCKERFILE} -t ${IMAGE} . echo Built ${IMAGE}