-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.default
37 lines (29 loc) · 1.25 KB
/
Makefile.default
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
REGISTRY?=localhost:5000
ARCH=amd64 arm64
tag=latest
alpine-tag?=latest
all: clean build commit test
build: $(ARCH:%=build-%)
test: $(ARCH:%=test-%)
manifest:
buildah manifest create $(image)
build-default: clean manifest $(ARCH:%=build-default-%)
$(ARCH:%=build-default-%):
buildah --arch $(@:build-default-%=%) --name $(image):$(@:build-default-%=%) from --pull-always docker.io/alpine:$(alpine-tag)
buildah config --cmd '[]' --created-by 'buildah' $(image):$(@:build-default-%=%)
buildah run $(image):$(@:build-default-%=%) adduser -h /root -g operator -s /sbin/nologin -D -H -u 11 -G root operator root
if [ -f install.sh ]; then buildah run $(image):$(@:build-default-%=%) /bin/sh -e <install.sh; fi
if [ -d overlay ]; then buildah copy $(image):$(@:build-default-%=%) overlay/ /; fi
commit: $(ARCH:%=commit-%)
$(ARCH:%=commit-%):
buildah commit --manifest $(image) --rm $(image):$(@:commit-%=%) $(image):$(@:commit-%=%)
push:
buildah manifest push --all --format v2s2 $(image) "docker://$(REGISTRY)/$(image):$(tag)"
buildah tag $(image) "$(REGISTRY)/$(image):$(tag)"
inspect:
buildah inspect $(image)
clean:
-buildah manifest rm $(image)
-buildah rm $(ARCH:%=$(image):%)
-buildah rmi $(ARCH:%=$(image):%)
.PHONY: build default-build test push inspect clean