Skip to content

Commit

Permalink
build: Add support for RISC-V
Browse files Browse the repository at this point in the history
Signed-off-by: Antony Chazapis <[email protected]>
  • Loading branch information
chazapis committed Oct 22, 2023
1 parent abf9836 commit 0c4d3b9
Show file tree
Hide file tree
Showing 4 changed files with 404 additions and 19 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ linux/amd64, linux/arm64 ]
platform: [ linux/amd64, linux/arm64, linux/riscv64 ]
target: [ workflow-controller, argocli, argoexec ]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -79,13 +79,21 @@ jobs:
tag_suffix=$(echo $PLATFORM | sed -r "s/\//-/g")
image_name="${DOCKERIO_ORG}/${TARGET}:${tag}-${tag_suffix}"
extra_build_args=""
if [ $PLATFORM = "linux/riscv64" ]; then
extra_build_args="--build-arg BUILDER_IMAGE=riscv64/alpine:edge \
--build-arg UI_IMAGE=riscv64/alpine:edge \
--build-arg DISTROLESS_IMAGE=ghcr.io/go-riscv/distroless/static-unstable"
fi
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--output "type=image,push=true" \
--build-arg GIT_COMMIT=$GIT_COMMIT \
--build-arg GIT_TAG=$GIT_TAG \
--build-arg GIT_TREE_STATE=$GIT_TREE_STATE \
$extra_build_args \
--platform="${PLATFORM}" \
--target $TARGET \
--provenance=false \
Expand Down Expand Up @@ -186,11 +194,11 @@ jobs:
image_name="${docker_org}/${target}:${tag}"
if [ $target = "argoexec" ]; then
docker manifest create $image_name ${image_name}-linux-arm64 ${image_name}-linux-amd64 ${image_name}-windows
docker manifest create quay.io/$image_name quay.io/${image_name}-linux-arm64 quay.io/${image_name}-linux-amd64 quay.io/${image_name}-windows
docker manifest create $image_name ${image_name}-linux-riscv64 ${image_name}-linux-arm64 ${image_name}-linux-amd64 ${image_name}-windows
docker manifest create quay.io/$image_name quay.io/${image_name}-linux-riscv64 quay.io/${image_name}-linux-arm64 quay.io/${image_name}-linux-amd64 quay.io/${image_name}-windows
else
docker manifest create $image_name ${image_name}-linux-arm64 ${image_name}-linux-amd64
docker manifest create quay.io/$image_name quay.io/${image_name}-linux-arm64 quay.io/${image_name}-linux-amd64
docker manifest create $image_name ${image_name}-linux-riscv64 ${image_name}-linux-arm64 ${image_name}-linux-amd64
docker manifest create quay.io/$image_name quay.io/${image_name}-linux-riscv64 quay.io/${image_name}-linux-arm64 quay.io/${image_name}-linux-amd64
fi
docker manifest push $image_name
Expand Down
23 changes: 16 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
ARG GIT_COMMIT=unknown
ARG GIT_TAG=unknown
ARG GIT_TREE_STATE=unknown
ARG BUILDER_IMAGE=golang:1.21-alpine3.18
ARG UI_IMAGE=node:20-alpine
ARG DISTROLESS_IMAGE=gcr.io/distroless/static

FROM golang:1.21-alpine3.18 as builder
FROM $BUILDER_IMAGE as builder

RUN apk update && apk add --no-cache \
RUN apk update && \
(command -v go >/dev/null 2>&1 || apk add --no-cache go) && \
apk add --no-cache \
git \
make \
ca-certificates \
Expand All @@ -24,9 +29,13 @@ COPY . .

####################################################################################################

FROM node:20-alpine as argo-ui
FROM $UI_IMAGE as argo-ui

RUN apk update && apk add --no-cache git
RUN apk update && \
(command -v node >/dev/null 2>&1 || apk add --no-cache nodejs-current) && \
(command -v yarn >/dev/null 2>&1 || apk add --no-cache yarn) && \
apk add --no-cache \
git

COPY ui/package.json ui/yarn.lock ui/

Expand Down Expand Up @@ -76,7 +85,7 @@ RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache

####################################################################################################

FROM gcr.io/distroless/static as argoexec
FROM $DISTROLESS_IMAGE as argoexec

COPY --from=argoexec-build /go/src/github.com/argoproj/argo-workflows/dist/argoexec /bin/
COPY --from=argoexec-build /etc/mime.types /etc/mime.types
Expand All @@ -87,7 +96,7 @@ ENTRYPOINT [ "argoexec" ]

####################################################################################################

FROM gcr.io/distroless/static as workflow-controller
FROM $DISTROLESS_IMAGE as workflow-controller

USER 8737

Expand All @@ -99,7 +108,7 @@ ENTRYPOINT [ "workflow-controller" ]

####################################################################################################

FROM gcr.io/distroless/static as argocli
FROM $DISTROLESS_IMAGE as argocli

USER 8737

Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ dist/argo-linux-amd64: GOARGS = GOOS=linux GOARCH=amd64
dist/argo-linux-arm64: GOARGS = GOOS=linux GOARCH=arm64
dist/argo-linux-ppc64le: GOARGS = GOOS=linux GOARCH=ppc64le
dist/argo-linux-s390x: GOARGS = GOOS=linux GOARCH=s390x
dist/argo-linux-riscv64: GOARGS = GOOS=linux GOARCH=riscv64
dist/argo-darwin-amd64: GOARGS = GOOS=darwin GOARCH=amd64
dist/argo-darwin-arm64: GOARGS = GOOS=darwin GOARCH=arm64
dist/argo-windows-amd64: GOARGS = GOOS=windows GOARCH=amd64
Expand Down Expand Up @@ -211,7 +212,7 @@ endif
argocli-image:

.PHONY: clis
clis: dist/argo-linux-amd64.gz dist/argo-linux-arm64.gz dist/argo-linux-ppc64le.gz dist/argo-linux-s390x.gz dist/argo-darwin-amd64.gz dist/argo-darwin-arm64.gz dist/argo-windows-amd64.gz
clis: dist/argo-linux-amd64.gz dist/argo-linux-arm64.gz dist/argo-linux-ppc64le.gz dist/argo-linux-s390x.gz dist/argo-linux-riscv64.gz dist/argo-darwin-amd64.gz dist/argo-darwin-arm64.gz dist/argo-windows-amd64.gz

# controller

Expand Down Expand Up @@ -487,7 +488,7 @@ argosay:
ifeq ($(DOCKER_PUSH),true)
cd test/e2e/images/argosay/v2 && \
docker buildx build \
--platform linux/amd64,linux/arm64 \
--platform linux/amd64,linux/arm64,linux/riscv64 \
-t argoproj/argosay:v2 \
--push \
.
Expand All @@ -504,7 +505,7 @@ argosayv1:
ifeq ($(DOCKER_PUSH),true)
cd test/e2e/images/argosay/v1 && \
docker buildx build \
--platform linux/amd64,linux/arm64 \
--platform linux/amd64,linux/arm64,linux/riscv64 \
-t argoproj/argosay:v1 \
--push \
.
Expand Down
Loading

0 comments on commit 0c4d3b9

Please sign in to comment.