Skip to content

Commit

Permalink
build: support local arm64 and amd64 image (#12754)
Browse files Browse the repository at this point in the history
Co-authored-by: agilgur5 <agilgur5@gmail.com>
Signed-off-by: heidongxianhua <18207133434@163.com>
  • Loading branch information
heidongxianhua and agilgur5 committed Apr 7, 2024
1 parent 00101c6 commit 3496712
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ SRC := $(GOPATH)/src/github.com/argoproj/argo-workflows
# docker image publishing options
IMAGE_NAMESPACE ?= quay.io/argoproj
DEV_IMAGE ?= $(shell [ `uname -s` = Darwin ] && echo true || echo false)
TARGET_PLATFORM := $(shell [ `uname -m` = arm64 ] && echo linux/arm64 || echo linux/amd64)

# declares which cluster to import to in case it's not the default name
K3D_CLUSTER_NAME ?= k3s-default
Expand Down Expand Up @@ -99,7 +100,7 @@ ALWAYS_OFFLOAD_NODE_STATUS := false
POD_STATUS_CAPTURE_FINALIZER ?= true

$(info GIT_COMMIT=$(GIT_COMMIT) GIT_BRANCH=$(GIT_BRANCH) GIT_TAG=$(GIT_TAG) GIT_TREE_STATE=$(GIT_TREE_STATE) RELEASE_TAG=$(RELEASE_TAG) DEV_BRANCH=$(DEV_BRANCH) VERSION=$(VERSION))
$(info KUBECTX=$(KUBECTX) DOCKER_DESKTOP=$(DOCKER_DESKTOP) K3D=$(K3D) DOCKER_PUSH=$(DOCKER_PUSH))
$(info KUBECTX=$(KUBECTX) DOCKER_DESKTOP=$(DOCKER_DESKTOP) K3D=$(K3D) DOCKER_PUSH=$(DOCKER_PUSH) TARGET_PLATFORM=$(TARGET_PLATFORM))
$(info RUN_MODE=$(RUN_MODE) PROFILE=$(PROFILE) AUTH_MODE=$(AUTH_MODE) SECURE=$(SECURE) STATIC_FILES=$(STATIC_FILES) ALWAYS_OFFLOAD_NODE_STATUS=$(ALWAYS_OFFLOAD_NODE_STATUS) UPPERIO_DB_DEBUG=$(UPPERIO_DB_DEBUG) LOG_LEVEL=$(LOG_LEVEL) NAMESPACED=$(NAMESPACED))

override LDFLAGS += \
Expand Down Expand Up @@ -243,6 +244,7 @@ argoexec-image:
%-image:
[ ! -e dist/$* ] || mv dist/$* .
docker buildx build \
--platform $(TARGET_PLATFORM) \
--build-arg GIT_COMMIT=$(GIT_COMMIT) \
--build-arg GIT_TAG=$(GIT_TAG) \
--build-arg GIT_TREE_STATE=$(GIT_TREE_STATE) \
Expand Down
7 changes: 7 additions & 0 deletions docs/running-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ If you made changes to the executor, you need to build the image:
make argoexec-image
```

You can use the `TARGET_PLATFORM` environment variable to compile images for specific platforms:

```bash
# compile for both arm64 and amd64
make argoexec-image TARGET_PLATFORM=linux/arm64,linux/amd64
```

To also start the API on <http://localhost:2746>:

```bash
Expand Down

0 comments on commit 3496712

Please sign in to comment.