-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
55 lines (48 loc) · 1.43 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
BUILD_NAME=python
OWNER=groovytron
COMPOSE_BUILD_NAME=python-container
VERSIONS=3.8 3.7 3.6
LATEST=3.8
LATEST_LABEL=latest
ALL=$(addprefix python,$(VERSIONS))
VCS_REF="$(shell git rev-parse HEAD)"
BUILD_DATE="$(shell date -u +"%Y-%m-%dT%H:%m:%SZ")"
CURRENT_DATE="$(shell date +"%Y%m%d")"
.PHONY: all
all: $(ALL)
.PHONY: $(ALL)
$(ALL):
BUILD_DATE=$(BUILD_DATE) \
BUILD_NAME=$(BUILD_NAME) \
COMPOSE_BUILD_NAME=$(COMPOSE_BUILD_NAME) \
VCS_REF=$(VCS_REF) \
docker-compose -f build.yml build \
$@
.PHONY:clean
clean:
for VERSION in $(VERSIONS); do \
docker image rm -f $(COMPOSE_BUILD_NAME):$$VERSION; \
done
.PHONY:tag
tag:
for VERSION in $(VERSIONS); do \
docker tag $(COMPOSE_BUILD_NAME):$$VERSION $(OWNER)/$(BUILD_NAME):$$VERSION && \
docker tag $(COMPOSE_BUILD_NAME):$$VERSION $(OWNER)/$(BUILD_NAME):$$VERSION-$(CURRENT_DATE); \
done && \
docker tag $(COMPOSE_BUILD_NAME):$(LATEST) $(OWNER)/$(BUILD_NAME):$(LATEST_LABEL)
.PHONY:publish
publish: tag
for VERSION in $(VERSIONS); do \
docker push $(OWNER)/$(BUILD_NAME):$$VERSION && \
docker push $(OWNER)/$(BUILD_NAME):$$VERSION-$(CURRENT_DATE); \
done && \
docker push $(OWNER)/$(BUILD_NAME):$(LATEST_LABEL)
.PHONY:clean-tests
clean-test:
rm -rf test_pipenv test_poetry
.PHONY:build-3.12
build-3.12:
buildah build -f 3.12/Dockerfile -t localhost/$(COMPOSE_BUILD_NAME):3.12 \
--build-arg BUILD_DATE=$(BUILD_DATE) \
--build-arg VCS_REF=$(VCS_REF) \
--build-arg POETRY_VERSION=1.8.4