Skip to content

Instantly share code, notes, and snippets.

@GnaphronG
Created October 7, 2019 18:41
Show Gist options
  • Save GnaphronG/847df17cf9d9ed0f8d50e15b81655b78 to your computer and use it in GitHub Desktop.
Save GnaphronG/847df17cf9d9ed0f8d50e15b81655b78 to your computer and use it in GitHub Desktop.
Makefile to build multiarch function
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