-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from hasheddan/imagelight
Switch to using buildx and imagelight.mk for multi-arch builds
- Loading branch information
Showing
7 changed files
with
47 additions
and
43 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
Submodule build
updated
5 files
+3 −0 | .gitignore | |
+2 −2 | cross/Dockerfile | |
+6 −0 | makelib/image.mk | |
+123 −0 | makelib/imagelight.mk | |
+4 −4 | makelib/k8s_tools.mk |
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,11 +1,10 @@ | ||
FROM BASEIMAGE | ||
RUN apk --no-cache add ca-certificates bash | ||
FROM gcr.io/distroless/static@sha256:d2b0ec3141031720cf5eedef3493b8e129bc91935a43b50562fbe5429878d96b | ||
|
||
ARG ARCH | ||
ARG TINI_VERSION | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
ADD provider /usr/local/bin/crossplane-digitalocean-provider | ||
ADD bin/$TARGETOS\_$TARGETARCH/provider /usr/local/bin/crossplane-digitalocean-provider | ||
|
||
EXPOSE 8080 | ||
USER 1001 | ||
USER 65532 | ||
ENTRYPOINT ["crossplane-digitalocean-provider"] |
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,25 +1,35 @@ | ||
# ==================================================================================== | ||
# Setup Project | ||
|
||
PLATFORMS := linux_amd64 linux_arm64 | ||
include ../../../build/makelib/common.mk | ||
|
||
# ==================================================================================== | ||
# Options | ||
IMAGE = $(BUILD_REGISTRY)/provider-digitalocean-controller-$(ARCH) | ||
include ../../../build/makelib/image.mk | ||
|
||
include ../../../build/makelib/imagelight.mk | ||
|
||
# ==================================================================================== | ||
# Targets | ||
|
||
img.build: | ||
@$(INFO) docker build $(IMAGE) | ||
@$(MAKE) BUILD_ARGS="--load" img.build.shared | ||
@$(OK) docker build $(IMAGE) | ||
|
||
img.publish: | ||
@$(INFO) docker publish $(IMAGE) | ||
@$(MAKE) BUILD_ARGS="--push" img.build.shared | ||
@$(OK) docker publish $(IMAGE) | ||
|
||
img.build.shared: | ||
@cp Dockerfile $(IMAGE_TEMP_DIR) || $(FAIL) | ||
@cp $(OUTPUT_DIR)/bin/$(OS)_$(ARCH)/provider $(IMAGE_TEMP_DIR) || $(FAIL) | ||
@cd $(IMAGE_TEMP_DIR) && $(SED_CMD) 's|BASEIMAGE|$(OSBASEIMAGE)|g' Dockerfile || $(FAIL) | ||
@docker build $(BUILD_ARGS) \ | ||
--build-arg ARCH=$(ARCH) \ | ||
--build-arg TINI_VERSION=$(TINI_VERSION) \ | ||
@cp -r $(OUTPUT_DIR)/bin/ $(IMAGE_TEMP_DIR)/bin || $(FAIL) | ||
@docker buildx build $(BUILD_ARGS) \ | ||
--platform $(IMAGE_PLATFORMS) \ | ||
-t $(IMAGE) \ | ||
$(IMAGE_TEMP_DIR) || $(FAIL) | ||
@$(OK) docker build $(IMAGE) | ||
|
||
img.promote: | ||
@$(INFO) docker promote $(FROM_IMAGE) to $(TO_IMAGE) | ||
@docker buildx imagetools create -t $(TO_IMAGE) $(FROM_IMAGE) | ||
@$(OK) docker promote $(FROM_IMAGE) to $(TO_IMAGE) |
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,3 +1,3 @@ | ||
FROM BASEIMAGE | ||
FROM scratch | ||
|
||
COPY package.yaml . |
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,28 +1,37 @@ | ||
# ==================================================================================== | ||
# Setup Project | ||
|
||
PLATFORMS := linux_amd64 linux_arm64 | ||
include ../../../build/makelib/common.mk | ||
|
||
# ==================================================================================== | ||
# Options | ||
IMAGE = $(BUILD_REGISTRY)/provider-digitalocean-$(ARCH) | ||
OSBASEIMAGE = scratch | ||
include ../../../build/makelib/image.mk | ||
|
||
include ../../../build/makelib/imagelight.mk | ||
|
||
# ==================================================================================== | ||
# Targets | ||
|
||
img.build: | ||
@$(INFO) docker build $(IMAGE) | ||
@$(MAKE) BUILD_ARGS="--load" img.build.shared | ||
@$(OK) docker build $(IMAGE) | ||
|
||
img.publish: | ||
@$(INFO) docker publish $(IMAGE) | ||
@$(MAKE) BUILD_ARGS="--push" img.build.shared | ||
@$(OK) docker publish $(IMAGE) | ||
|
||
img.build.shared: | ||
@cp Dockerfile $(IMAGE_TEMP_DIR) || $(FAIL) | ||
@cp -R ../../../package $(IMAGE_TEMP_DIR) || $(FAIL) | ||
@cd $(IMAGE_TEMP_DIR) && $(SED_CMD) 's|BASEIMAGE|$(OSBASEIMAGE)|g' Dockerfile || $(FAIL) | ||
@cd $(IMAGE_TEMP_DIR) && $(SED_CMD) 's|VERSION|$(VERSION)|g' package/crossplane.yaml || $(FAIL) | ||
@cd $(IMAGE_TEMP_DIR) && find package -type f -name '*.yaml' -exec cat {} >> 'package.yaml' \; -exec printf '\n---\n' \; || $(FAIL) | ||
@docker build $(BUILD_ARGS) \ | ||
--build-arg ARCH=$(ARCH) \ | ||
--build-arg TINI_VERSION=$(TINI_VERSION) \ | ||
@docker buildx build $(BUILD_ARGS) \ | ||
--platform $(IMAGE_PLATFORMS) \ | ||
-t $(IMAGE) \ | ||
$(IMAGE_TEMP_DIR) || $(FAIL) | ||
@$(OK) docker build $(IMAGE) | ||
|
||
img.promote: | ||
@$(INFO) docker promote $(FROM_IMAGE) to $(TO_IMAGE) | ||
@docker buildx imagetools create -t $(TO_IMAGE) $(FROM_IMAGE) | ||
@$(OK) docker promote $(FROM_IMAGE) to $(TO_IMAGE) |
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