Created
October 7, 2019 18:41
-
-
Save GnaphronG/847df17cf9d9ed0f8d50e15b81655b78 to your computer and use it in GitHub Desktop.
Makefile to build multiarch function
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
OPENFAAS_URL?=http://faasgw:31112 | |
PLATFORMS:=linux/amd64,linux/arm/v7 | |
REGISTRY:=docker.io | |
fname = $(lastword $(subst -, ,$1)) | |
all-%: generate-% build-% deploy-% | |
@echo faas-cli invoke -g $(OPENFAAS_URL) $(call fname, $@) | |
generate-%: | |
$(eval function:=$(call fname, $@)) | |
@faas-cli build --shrinkwrap --image $(function) -f $(function).yml | |
build-%: | |
ifndef TAG | |
$(eval TAG:=$(REGISTRY)/$(call fname, $@)) | |
endif | |
@cd build/$(call fname, $@) && \ | |
docker buildx build --platform $(PLATFORMS) -t $(TAG) --push . | |
deploy-%: | |
@faas-cli deploy -f $(call fname, $@).yml -g $(OPENFAAS_URL) | |
.PHONY: deploy-% build-% generate-% all-% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment