Build multi-arch images by default
This commit is contained in:
parent
0f20548386
commit
d250b97b43
18 changed files with 226 additions and 206 deletions
|
|
@ -17,24 +17,33 @@
|
|||
# Use the 0.0 tag for testing, it shouldn't clobber any release builds
|
||||
TAG ?= 0.0
|
||||
|
||||
REGISTRY ?= ingress-controller
|
||||
DOCKER ?= docker
|
||||
HOSTARCH := $(shell uname -m | sed -e s/x86_64/amd64/ \
|
||||
-e s/s390x/s390x/ \
|
||||
-e s/armv7l/arm/ \
|
||||
-e s/aarch64.*/arm64/)
|
||||
|
||||
IMGNAME = fastcgi-helloserver
|
||||
IMAGE = $(REGISTRY)/$(IMGNAME)
|
||||
ifndef ARCH
|
||||
ARCH := $(HOSTARCH)
|
||||
endif
|
||||
ifeq ($(ARCH),)
|
||||
$(error mandatory variable ARCH is empty)
|
||||
endif
|
||||
|
||||
REGISTRY ?= ingress-controller
|
||||
|
||||
IMAGE = $(REGISTRY)/fastcgi-helloserver
|
||||
|
||||
PKG=k8s.io/ingress-nginx/images/fastcgi-helloserver
|
||||
|
||||
container: clean build
|
||||
$(DOCKER) buildx build \
|
||||
.PHONY: image
|
||||
image: build
|
||||
docker buildx build \
|
||||
--load \
|
||||
--platform linux/amd64 \
|
||||
--platform $(ARCH) \
|
||||
-t $(IMAGE):$(TAG) rootfs
|
||||
|
||||
build: clean
|
||||
CGO_ENABLED=0 go build -a -installsuffix cgo \
|
||||
.PHONY: build
|
||||
build:
|
||||
GOARCH=$(ARCH) CGO_ENABLED=0 go build -a -installsuffix cgo \
|
||||
-ldflags "-s -w" \
|
||||
-o rootfs/fastcgi-helloserver ${PKG}/...
|
||||
|
||||
clean:
|
||||
$(DOCKER) rmi -f $(IMAGE):$(TAG) || true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue