-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
60 lines (53 loc) · 1.28 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
BUILD_NAME=android
COMPOSE_BUILD_NAME=android-container
VERSIONS=29 28 27 26 25
LATEST=$(firstword $(VERSIONS))
ALL=$(addprefix $(BUILD_NAME),$(VERSIONS))
VCS_REF="$(shell git rev-parse HEAD)"
BUILD_DATE="$(shell date -u +"%Y-%m-%dT%H:%m:%SZ")"
DOCKERHUB_USER=groovytron
.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.yaml build \
$@
.PHONY:clean
clean:
for VERSION in $(VERSIONS); do \
docker image rm -f $(COMPOSE_BUILD_NAME):$$VERSION; \
done
.PHONY:publish-docker-images
publish-docker-images:
for VERSION in $(VERSIONS); do \
docker tag $(COMPOSE_BUILD_NAME):$$VERSION $(DOCKERHUB_USER)/$(BUILD_NAME):$$VERSION && \
docker push $(DOCKERHUB_USER)/$(BUILD_NAME):$$VERSION; \
done && \
docker tag $(COMPOSE_BUILD_NAME):$(LATEST) $(DOCKERHUB_USER)/$(BUILD_NAME):latest && \
docker push $(DOCKERHUB_USER)/$(BUILD_NAME):latest
.PHONY: run
run: build
docker run \
-it \
--entrypoint /bin/bash \
--name $(CONTAINER_NAME) \
--user=dev \
$(BUILD_NAME)
.PHONY:jumpin
jumpin:
docker exec \
-it \
--user=dev \
$(CONTAINER_NAME) \
/bin/bash
.PHONY:rootin
rootin:
docker exec \
-it \
--user=root \
$(CONTAINER_NAME) \
/bin/bash