chore: update Makefile for build multi architecture container image#225
Merged
Peefy merged 1 commit intokcl-lang:mainfrom Apr 22, 2025
Merged
chore: update Makefile for build multi architecture container image#225Peefy merged 1 commit intokcl-lang:mainfrom
Peefy merged 1 commit intokcl-lang:mainfrom
Conversation
* Add workflow to run build image test Signed-off-by: Lan Liang <gcslyp@gmail.com>
0e74d69 to
e3c2fe2
Compare
Pull Request Test Coverage Report for Build 14586906345Details
💛 - Coveralls |
liangyuanpeng
commented
Apr 22, 2025
Comment on lines
+96
to
+144
| GO_VERSION := $(shell awk '/^go /{print $$2}' go.mod|head -n1) | ||
|
|
||
| GIT_TAG ?= $(shell git describe --tags --dirty --always) | ||
| # Image URL to use all building/pushing image targets | ||
| PLATFORMS ?= linux/amd64,linux/arm64 | ||
| DOCKER_BUILDX_CMD ?= docker buildx | ||
| IMAGE_BUILD_CMD ?= $(DOCKER_BUILDX_CMD) build | ||
| BASE_IMAGE ?= debian:11-slim | ||
| BUILDER_IMAGE ?= golang:$(GO_VERSION) | ||
| CGO_ENABLED ?= 0 | ||
|
|
||
| IMAGE_BUILD_EXTRA_OPTS ?= | ||
|
|
||
| IMAGE_REGISTRY ?= ghcr.io/kcl-lang | ||
| IMAGE_NAME := kcl | ||
| IMAGE_REPO ?= $(IMAGE_REGISTRY)/$(IMAGE_NAME) | ||
| IMAGE_TAG ?= $(IMAGE_REPO):$(GIT_TAG) | ||
|
|
||
| ifdef EXTRA_TAG | ||
| IMAGE_EXTRA_TAG ?= $(IMAGE_REPO):$(EXTRA_TAG) | ||
| endif | ||
| ifdef IMAGE_EXTRA_TAG | ||
| IMAGE_BUILD_EXTRA_OPTS += -t $(IMAGE_EXTRA_TAG) | ||
| endif | ||
|
|
||
| # Build the multiplatform container image locally and push to repo. | ||
| .PHONY: image-local-push | ||
| image-local-push: PUSH=--push | ||
| image-local-push: image-local-build | ||
|
|
||
| # Build the multiplatform container image locally. | ||
| .PHONY: image-local-build | ||
| image-local-build: | ||
| BUILDER=$(shell $(DOCKER_BUILDX_CMD) create --use) | ||
| $(MAKE) image-build PUSH=$(PUSH) | ||
| $(DOCKER_BUILDX_CMD) rm $$BUILDER | ||
|
|
||
| .PHONY: image-push | ||
| image-push: PUSH=--push | ||
| image-push: image-build | ||
|
|
||
| image-build: | ||
| $(IMAGE_BUILD_CMD) -t $(IMAGE_TAG) \ | ||
| --platform=$(PLATFORMS) \ | ||
| --build-arg BASE_IMAGE=$(BASE_IMAGE) \ | ||
| --build-arg BUILDER_IMAGE=$(BUILDER_IMAGE) \ | ||
| --build-arg CGO_ENABLED=$(CGO_ENABLED) \ | ||
| $(PUSH) \ | ||
| $(IMAGE_BUILD_EXTRA_OPTS) ./ |
Contributor
Author
There was a problem hiding this comment.
Basically, it's copied from https://github.com/kubernetes-sigs/kueue/blob/main/Makefile
Contributor
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
releated:
TODO: update release workflow to using Makefile and not github action, i think it will not incluing in this PR.
1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):
2. What is the scope of this PR (e.g. component or file name):
3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):
4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):
5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links: