Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for RISC-V #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,48 @@ volumes:
host:
path: /var/run/docker.sock

---
kind: pipeline
name: risv64
type: docker

platform:
os: linux
arch: amd64

steps:
- name: build
image: rancher/dapper:v0.5.0
commands:
- ARCH=riscv64 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-lb"
tag: "${DRONE_TAG}-riscv64"
username:
from_secret: docker_username
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: arm
Expand Down Expand Up @@ -199,6 +241,7 @@ steps:
- linux/arm64
- linux/arm
- linux/s390x
- linux/riscv64
target: "rancher/klipper-lb:${DRONE_TAG}"
template: "rancher/klipper-lb:${DRONE_TAG}-ARCH"
when:
Expand All @@ -215,3 +258,4 @@ depends_on:
- arm64
- arm
- s390x
- riscv64
4 changes: 2 additions & 2 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM golang:1.20-alpine3.16

ARG DAPPER_HOST_ARCH
ENV ARCH $DAPPER_HOST_ARCH
ENV HOST_ARCH $DAPPER_HOST_ARCH

RUN apk -U add bash git gcc musl-dev docker vim less file curl wget ca-certificates
RUN if [ "$(go env GOARCH)" = "amd64" ]; then \
curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.40.0; \
fi

ENV DAPPER_ENV REPO TAG DRONE_TAG
ENV DAPPER_ENV REPO TAG DRONE_TAG ARCH
ENV DAPPER_SOURCE /go/src/github.com/rancher/klipper-lb/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
Expand Down
3 changes: 2 additions & 1 deletion package/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM alpine:3.18
ARG BASE=alpine:3.18
FROM $BASE
ARG BUILDDATE
LABEL buildDate=$BUILDDATE
RUN apk --no-cache upgrade && \
Expand Down
6 changes: 5 additions & 1 deletion scripts/package
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ if [ -e ${DOCKERFILE}.${ARCH} ]; then
DOCKERFILE=${DOCKERFILE}.${ARCH}
fi

docker build --build-arg BUILDDATE=$(date +%Y%m%d) -f ${DOCKERFILE} -t ${IMAGE} .
if [ "$ARCH" = "riscv64" ]; then
export DOCKER_BUILDKIT=1
DOCKER_ARGS="--platform=$ARCH --build-arg BASE=riscv64/alpine:edge"
fi
docker build ${DOCKER_ARGS} --build-arg BUILDDATE=$(date +%Y%m%d) -f ${DOCKERFILE} -t ${IMAGE} .
echo Built ${IMAGE}