generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 961
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 docker buildx build to the Makefile to build and push multi-arch docker images #1915
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ INIT_USERS_IMG ?= ${IMG_REPO}/init-users | |
WEBHOOK_IMG ?= ${IMG_REPO}/fluid-webhook | ||
GO_MODULE ?= off | ||
GC_FLAGS ?= -gcflags="all=-N -l" | ||
ARCH ?= amd64 | ||
|
||
LOCAL_FLAGS ?= -gcflags=-l | ||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) | ||
|
@@ -26,10 +27,10 @@ GOBIN=$(shell go env GOBIN) | |
endif | ||
|
||
UNAME := $(shell uname -m) | ||
ifeq ($(UNAME), x86_64) | ||
ARCH := amd64 | ||
else | ||
ifeq ($(UNAME), aarch64) | ||
ARCH := arm64 | ||
else | ||
ARCH := amd64 | ||
endif | ||
|
||
CURRENT_DIR=$(shell pwd) | ||
|
@@ -73,6 +74,17 @@ DOCKER_PUSH += docker-push-goosefsruntime-controller | |
DOCKER_PUSH += docker-push-juicefsruntime-controller | ||
DOCKER_PUSH += docker-push-init-users | ||
|
||
# Buildx and push docker images | ||
DOCKER_BUILDX_PUSH := docker-buildx-push-dataset-controller | ||
DOCKER_BUILDX_PUSH += docker-buildx-push-application-controller | ||
DOCKER_BUILDX_PUSH += docker-buildx-push-alluxioruntime-controller | ||
DOCKER_BUILDX_PUSH += docker-buildx-push-jindoruntime-controller | ||
DOCKER_BUILDX_PUSH += docker-buildx-push-goosefsruntime-controller | ||
DOCKER_BUILDX_PUSH += docker-buildx-push-csi | ||
DOCKER_BUILDX_PUSH += docker-buildx-push-webhook | ||
DOCKER_BUILDX_PUSH += docker-buildx-push-juicefsruntime-controller | ||
DOCKER_BUILDX_PUSH += docker-buildx-push-init-users | ||
|
||
override LDFLAGS += \ | ||
-X ${PACKAGE}.version=${VERSION} \ | ||
-X ${PACKAGE}.buildDate=${BUILD_DATE} \ | ||
|
@@ -165,22 +177,22 @@ update-api-doc: | |
|
||
# Build the docker image | ||
docker-build-dataset-controller: generate gen-openapi fmt vet | ||
docker build --no-cache . -f docker/Dockerfile.dataset -t ${DATASET_CONTROLLER_IMG}:${GIT_VERSION} | ||
docker build --no-cache --build-arg TARGETARCH=${ARCH} . -f docker/Dockerfile.dataset -t ${DATASET_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-build-application-controller: generate fmt vet | ||
docker build --no-cache . -f docker/Dockerfile.application -t ${APPLICATION_CONTROLLER_IMG}:${GIT_VERSION} | ||
docker build --no-cache --build-arg TARGETARCH=${ARCH} . -f docker/Dockerfile.application -t ${APPLICATION_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-build-alluxioruntime-controller: generate gen-openapi fmt vet | ||
docker build --no-cache . -f docker/Dockerfile.alluxioruntime -t ${ALLUXIORUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
docker build --no-cache --build-arg TARGETARCH=${ARCH} . -f docker/Dockerfile.alluxioruntime -t ${ALLUXIORUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-build-jindoruntime-controller: generate gen-openapi fmt vet | ||
docker build --no-cache . -f docker/Dockerfile.jindoruntime -t ${JINDORUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
docker build --no-cache --build-arg TARGETARCH=${ARCH} . -f docker/Dockerfile.jindoruntime -t ${JINDORUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-build-goosefsruntime-controller: generate gen-openapi fmt vet | ||
docker build --no-cache . -f docker/Dockerfile.goosefsruntime -t ${GOOSEFSRUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
docker build --no-cache --build-arg TARGETARCH=${ARCH} . -f docker/Dockerfile.goosefsruntime -t ${GOOSEFSRUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-build-juicefsruntime-controller: generate gen-openapi fmt vet juicefsruntime-controller-build | ||
docker build --no-cache . -f docker/Dockerfile.juicefsruntime -t ${JUICEFSRUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
docker build --no-cache --build-arg TARGETARCH=${ARCH} . -f docker/Dockerfile.juicefsruntime -t ${JUICEFSRUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-build-csi: generate fmt vet | ||
docker build --no-cache . -f docker/Dockerfile.csi -t ${CSI_IMG}:${GIT_VERSION} | ||
|
@@ -192,7 +204,7 @@ docker-build-init-users: | |
docker build --no-cache charts/alluxio/docker/init-users -t ${INIT_USERS_IMG}:${GIT_VERSION} | ||
|
||
docker-build-webhook: | ||
docker build --no-cache . -f docker/Dockerfile.webhook -t ${WEBHOOK_IMG}:${GIT_VERSION} | ||
docker build --no-cache --build-arg TARGETARCH=${ARCH} . -f docker/Dockerfile.webhook -t ${WEBHOOK_IMG}:${GIT_VERSION} | ||
|
||
# Push the docker image | ||
docker-push-dataset-controller: docker-build-dataset-controller | ||
|
@@ -225,10 +237,37 @@ docker-push-init-users: docker-build-init-users | |
docker-push-webhook: docker-build-webhook | ||
docker push ${WEBHOOK_IMG}:${GIT_VERSION} | ||
|
||
# Buildx and push the docker image | ||
docker-buildx-push-dataset-controller: generate gen-openapi fmt vet | ||
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.dataset -t ${DATASET_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-buildx-push-application-controller: generate fmt vet | ||
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.application -t ${APPLICATION_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-buildx-push-alluxioruntime-controller: generate gen-openapi fmt vet | ||
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.alluxioruntime -t ${ALLUXIORUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-buildx-push-jindoruntime-controller: generate gen-openapi fmt vet | ||
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.jindoruntime -t ${JINDORUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-buildx-push-goosefsruntime-controller: generate gen-openapi fmt vet | ||
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.goosefsruntime -t ${GOOSEFSRUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-buildx-push-juicefsruntime-controller: generate gen-openapi fmt vet juicefsruntime-controller-build | ||
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.juicefsruntime -t ${JUICEFSRUNTIME_CONTROLLER_IMG}:${GIT_VERSION} | ||
|
||
docker-buildx-push-csi: generate fmt vet | ||
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.csi -t ${CSI_IMG}:${GIT_VERSION} | ||
|
||
docker-buildx-push-init-users: | ||
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache charts/alluxio/docker/init-users -t ${INIT_USERS_IMG}:${GIT_VERSION} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems that empty line 263 cause
|
||
docker-buildx-push-webhook: | ||
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.webhook -t ${WEBHOOK_IMG}:${GIT_VERSION} | ||
|
||
docker-build-all: ${DOCKER_BUILD} | ||
docker-push-all: ${DOCKER_PUSH} | ||
docker-buildx-all-push: ${DOCKER_BUILDX_PUSH} | ||
|
||
gen-sdk: | ||
./hack/sdk/gen-sdk.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you set default value
amd64
forARCH
in front ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, added.