-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (51 loc) · 1.48 KB
/
Makefile
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
REPO=cwbak
NAME=psqlc
APPNAME=$(REPO)/$(NAME)
VERSION=$(shell cat ./version)
LATEST=latest
AMD64=amd64
ARM64=arm64
PLATFORM_AMD64:=linux/$(AMD64)
PLATFORM_ARM64:=linux/$(ARM64)
APPNAME_AMD64:=$(APPNAME)-$(AMD64)
APPNAME_ARM64:=$(APPNAME)-$(ARM64)
.PHONY: version all
all: build tag manifest publish
# build
build: build-amd64 build-arm64 manifest
build-amd64:
@echo "> Build AMD64 image"
@docker build -t $(APPNAME_AMD64):$(VERSION) --platform $(PLATFORM_AMD64) .
build-arm64:
@echo "> Build ARM64 image"
@docker build -t $(APPNAME_ARM64):$(VERSION) --platform $(PLATFORM_ARM64) .
# tag
tag: tag-amd64 tag-arm64
tag-amd64:
docker tag $(APPNAME_AMD64):$(VERSION) $(APPNAME_AMD64):$(LATEST)
tag-arm64:
docker tag $(APPNAME_ARM64):$(VERSION) $(APPNAME_ARM64):$(LATEST)
# manifest
manifest: manifest-version manifest-latest
manifest-version:
docker manifest create --amend $(APPNAME):$(VERSION) \
$(APPNAME_AMD64):$(VERSION) \
$(APPNAME_ARM64):$(VERSION)
manifest-latest:
docker manifest create --amend $(APPNAME):$(LATEST) \
$(APPNAME_AMD64):$(LATEST) \
$(APPNAME_ARM64):$(LATEST)
# publish
publish: publish-amd64 publish-arm64 publish-manifest
publish-amd64:
docker push $(APPNAME_AMD64):$(VERSION)
docker push $(APPNAME_AMD64):$(LATEST)
publish-arm64:
docker push $(APPNAME_ARM64):$(VERSION)
docker push $(APPNAME_ARM64):$(LATEST)
publish-manifest:
docker manifest push $(APPNAME):$(VERSION)
docker manifest push $(APPNAME):$(LATEST)
# version
version:
@echo $(VERSION)