-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
59 lines (47 loc) · 1.41 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
#!/usr/bin/env make
SHELL = /usr/bin/env sh
include ../../make/env.mk
VERSIONS = ./Versions
include $(VERSIONS)
DOCKER = /usr/bin/env docker
branches := 3.6 3.7 3.8 3.9
name := pywine
IMAGE_REPOSITORY = $(REGISTRY)/$(ORG)/$(name)
BASE_IMAGE = $(REGISTRY)/$(ORG)/wine-stable
.PHONY: all
all: $(branches)
.PHONY: $(branches)
$(branches): image = $(IMAGE_REPOSITORY)-$@
$(branches): version = $($@_version)
$(branches):
@echo "Building $(image):$(version) ..."
@$(DOCKER) build --pull \
--cache-from $(image):latest \
--build-arg CREATED_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \
--build-arg REFNAME=$(version) \
--build-arg REPOSITORY=$(CODE_REPOSITORY) \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--build-arg PY_VERSION=$(version) \
-t $(image):latest \
-t $(image):$(version) \
-f Dockerfile \
.
.PHONY: clean-branch
clean-branch: BRANCH := 3.9
clean-branch: image := $(IMAGE_REPOSITORY)-$(BRANCH)
clean-branch:
@$(DOCKER) rmi -f \
$$($(DOCKER) images --filter=reference="$(image)" --format="{{.ID}}") \
2>/dev/null \
|| echo "No image found matching \"$(image)\""
.PHONY: clean
clean:
@for branch in $(branches) ; do $(MAKE) clean-branch BRANCH=$$branch ; done
.PHONY: push-branch
push-branch: BRANCH := 3.9
push-branch: image := $(IMAGE_REPOSITORY)-$(BRANCH)
push-branch:
@$(DOCKER) push -a $(image)
.PHONY: push
push:
@for branch in $(branches) ; do $(MAKE) push-branch BRANCH=$$branch ; done