-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f6db88
commit 0d1853b
Showing
2 changed files
with
68 additions
and
97 deletions.
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
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 |
---|---|---|
@@ -1,16 +1,24 @@ | ||
TARGETS := $(shell ls scripts) | ||
RUNNER := docker | ||
IMAGE_BUILDER := $(RUNNER) buildx | ||
MACHINE := rancher | ||
BUILDX_ARGS ?= --sbom=true --attest type=provenance,mode=max | ||
DEFAULT_PLATFORMS := linux/amd64 | ||
|
||
.dapper: | ||
@echo Downloading dapper | ||
@curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp | ||
@@chmod +x .dapper.tmp | ||
@./.dapper.tmp -v | ||
@mv .dapper.tmp .dapper | ||
# Define target platforms, image builder and the fully qualified image name. | ||
TARGET_PLATFORMS ?= linux/amd64 | ||
|
||
$(TARGETS): .dapper | ||
./.dapper $@ | ||
REPO ?= rancher | ||
IMAGE = $(REPO)/rancher-csp-adapter:$(TAG) | ||
|
||
clean: | ||
rm -rf bin dist | ||
|
||
.PHONY: $(TARGETS) | ||
push-image: buildx-machine ## build the container image targeting all platforms defined by TARGET_PLATFORMS and push to a registry. | ||
$(IMAGE_BUILDER) build -f package/Dockerfile \ | ||
--builder $(MACHINE) $(IID_FILE_FLAG) $(BUILDX_ARGS) \ | ||
--platform=$(TARGET_PLATFORMS) -t "$(IMAGE)" --push . | ||
@echo "Pushed $(IMAGE)" | ||
|
||
.PHONY: buildx-machine | ||
buildx-machine: ## create rancher dockerbuildx machine targeting platform defined by DEFAULT_PLATFORMS. | ||
@docker buildx ls | grep $(MACHINE) || docker buildx create --name=$(MACHINE) --platform=$(DEFAULT_PLATFORMS) |