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

build: Add support for RISC-V #12067

Closed
wants to merge 1 commit into from
Closed
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
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) && \
Copy link

@agilgur5 agilgur5 Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add versions if we want this to match the regular alpine images.

this also feels very hacky to have different base images, but it sounds like there's no pre-built Alpine image with Go and Node for RISC-V?

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) && \
Comment on lines +35 to +36
Copy link

@agilgur5 agilgur5 Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above re: versioning

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