-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
25 lines (19 loc) · 937 Bytes
/
Makefile
File metadata and controls
25 lines (19 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
.PHONY: build-push build push
SHELL := /bin/bash
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
IMAGE := devodev/inotify
VERSION ?= 0.4.0
PLATFORMS ?= linux/amd64,linux/arm64
LONG_TAG := $(subst $(eval) ,.,$(wordlist 1,3,$(subst ., ,$(VERSION:%=%))))
SHORT_TAG := $(subst $(eval) ,.,$(wordlist 1,2,$(subst ., ,$(VERSION:%=%))))
TAGS := $(LONG_TAG) $(SHORT_TAG) latest
build-push:
@docker buildx create --name multiarch-builder --driver=docker-container --platform $(PLATFORMS) --bootstrap || :
@docker buildx build --builder multiarch-builder $(TAGS:%=-t $(IMAGE):%) --platform $(PLATFORMS) --push $(ROOT_DIR)
@docker buildx rm multiarch-builder
# requires containerd image store enabled to build and push separately
# https://docs.docker.com/build/building/multi-platform/
build:
@docker build $(TAGS:%=-t $(IMAGE):%) --platform $(PLATFORMS) $(ROOT_DIR)
push: build
@$(TAGS:%=docker push $(IMAGE):%;)