forked from PlugFox/docker_flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
143 lines (133 loc) · 6 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
-include *.mk
.PHONY: all build push shell prune scan demo
all:
@echo Вы можете использовать: build, push, shell
@echo make build FLUTTER_CHANNEL="stable"
@echo make push FLUTTER_CHANNEL="stable"
@echo make shell FLUTTER_CHANNEL="stable"
ifdef FLUTTER_VERSION
FLUTTER_VERSION_MAJOR_MINOR := $(basename $(FLUTTER_VERSION))
endif
# Собрать образы соответсвующего канала или версии
# Запускается с аргументом FLUTTER_CHANNEL или FLUTTER_VERSION
# make build FLUTTER_CHANNEL="<КАНАЛ>" e.g. make build FLUTTER_CHANNEL="stable"
# make build FLUTTER_VERSION="<ВЕРСИЯ>" e.g. make build FLUTTER_VERSION="2.5.3"
build:
ifdef FLUTTER_CHANNEL
@echo "BUILD FLUTTER CHANNEL $(FLUTTER_CHANNEL)"
@docker build --no-cache --force-rm --compress \
--file ./dockerfiles/flutter.dockerfile \
--build-arg FLUTTER_CHANNEL=$(FLUTTER_CHANNEL) \
--tag xanter/flutter:$(FLUTTER_CHANNEL) .
@docker build --no-cache --force-rm --compress \
--file ./dockerfiles/flutter_web.dockerfile \
--build-arg FLUTTER_CHANNEL=$(FLUTTER_CHANNEL) \
--tag "xanter/flutter:$(FLUTTER_CHANNEL)-web" .
@docker build --no-cache --force-rm --compress \
--file ./dockerfiles/flutter_android.dockerfile \
--build-arg FLUTTER_CHANNEL=$(FLUTTER_CHANNEL) \
--tag "xanter/flutter:$(FLUTTER_CHANNEL)-android" .
@docker build --no-cache --force-rm --compress \
--file ./dockerfiles/flutter_android_warmed.dockerfile \
--build-arg FLUTTER_CHANNEL=$(FLUTTER_CHANNEL) \
--tag "xanter/flutter:$(FLUTTER_CHANNEL)-android-warmed" .
endif
ifdef FLUTTER_VERSION
@echo "BUILD FLUTTER VERSION $(FLUTTER_VERSION)"
@docker build --no-cache --force-rm --compress \
--file ./dockerfiles/flutter.dockerfile \
--build-arg FLUTTER_VERSION=$(FLUTTER_VERSION) \
--tag xanter/flutter:$(FLUTTER_VERSION) \
--tag xanter/flutter:$(FLUTTER_VERSION_MAJOR_MINOR) \
.
@docker build --no-cache --force-rm --compress \
--file ./dockerfiles/flutter_web.dockerfile \
--build-arg FLUTTER_VERSION=$(FLUTTER_VERSION) \
--tag "xanter/flutter:$(FLUTTER_VERSION)-web" \
--tag "xanter/flutter:$(FLUTTER_VERSION_MAJOR_MINOR)-web" \
.
@docker build --no-cache --force-rm --compress \
--file ./dockerfiles/flutter_android.dockerfile \
--build-arg FLUTTER_VERSION=$(FLUTTER_VERSION) \
--tag "xanter/flutter:$(FLUTTER_VERSION)-android" \
--tag "xanter/flutter:$(FLUTTER_VERSION_MAJOR_MINOR)-android" \
.
@docker build --no-cache --force-rm --compress \
--file ./dockerfiles/flutter_android_warmed.dockerfile \
--build-arg FLUTTER_VERSION=$(FLUTTER_VERSION) \
--tag "xanter/flutter:$(FLUTTER_VERSION)-android-warmed" \
--tag "xanter/flutter:$(FLUTTER_VERSION_MAJOR_MINOR)-android-warmed" \
.
endif
# Отправить собраные образы
# Запускается с аргументом FLUTTER_CHANNEL или FLUTTER_VERSION
# make push FLUTTER_CHANNEL="<КАНАЛ>" e.g. make push FLUTTER_CHANNEL="stable"
# make push FLUTTER_VERSION="<ВЕРСИЯ>" e.g. make push FLUTTER_VERSION="2.5.3"
push:
ifdef FLUTTER_CHANNEL
@echo "PUSH FLUTTER $(FLUTTER_CHANNEL)"
@docker push xanter/flutter:$(FLUTTER_CHANNEL)
@docker push xanter/flutter:$(FLUTTER_CHANNEL)-web
@docker push xanter/flutter:$(FLUTTER_CHANNEL)-android
@docker push xanter/flutter:$(FLUTTER_CHANNEL)-android-warmed
endif
ifdef FLUTTER_VERSION
@echo "PUSH FLUTTER $(FLUTTER_VERSION)"
@docker push --all-tags xanter/flutter
# @docker push --all-tags xanter/flutter:$(FLUTTER_VERSION)
# @docker push --all-tags xanter/flutter:$(FLUTTER_VERSION)-web
# @docker push --all-tags xanter/flutter:$(FLUTTER_VERSION)-android
# @docker push --all-tags xanter/flutter:$(FLUTTER_VERSION)-android-warmed
endif
# Перейти в шелл образа
# Запускается с аргументом FLUTTER_CHANNEL или FLUTTER_VERSION
# make shell FLUTTER_CHANNEL="<КАНАЛ>" e.g. make shell FLUTTER_CHANNEL="stable"
# make shell FLUTTER_VERSION="<ВЕРСИЯ>" e.g. make shell FLUTTER_VERSION="2.5.3"
shell:
ifdef FLUTTER_CHANNEL
@docker run --rm -it -v $(shell pwd):/home --workdir /home \
--user=root:root \
--name flutter_$(FLUTTER_CHANNEL)_android_warmed \
xanter/flutter:$(FLUTTER_CHANNEL)-android-warmed /bin/bash
endif
ifdef FLUTTER_VERSION
@docker run --rm -it -v $(shell pwd):/home --workdir /home \
--user=root:root \
--name flutter_$(FLUTTER_VERSION)_android_warmed \
xanter/flutter:$(FLUTTER_VERSION)-android-warmed /bin/bash
endif
# Авторизоваться
login:
@docker login
# Очистить неиспользуемые образы с меткой
# family=xanter/flutter
prune:
@docker image prune -af --filter "label=family=xanter/flutter"
# Просканировать образ на наличие уязвимостей
# Запускается с аргументом FLUTTER_CHANNEL или FLUTTER_VERSION
# make scan FLUTTER_CHANNEL="<КАНАЛ>" e.g. make scan FLUTTER_CHANNEL="stable"
# make scan FLUTTER_VERSION="<ВЕРСИЯ>" e.g. make scan FLUTTER_VERSION="2.5.3"
scan:
ifdef FLUTTER_CHANNEL
@docker scan xanter/flutter:$(FLUTTER_CHANNEL)-android-warmed
endif
ifdef FLUTTER_VERSION
@docker scan xanter/flutter:$(FLUTTER_VERSION)-android-warmed
endif
# Проверить сборку
# Запускается с аргументом FLUTTER_CHANNEL или FLUTTER_VERSION
# make demo FLUTTER_CHANNEL="<КАНАЛ>" e.g. make demo FLUTTER_CHANNEL="stable"
# make demo FLUTTER_VERSION="<ВЕРСИЯ>" e.g. make demo FLUTTER_VERSION="2.5.3"
demo:
ifdef FLUTTER_CHANNEL
@docker run --rm -it -v $(shell pwd)/tools:/home/tools --workdir /home/tools \
--user=root:root \
--name flutter_$(FLUTTER_CHANNEL)_android_warmed \
xanter/flutter:$(FLUTTER_CHANNEL)-android-warmed sh /home/tools/build_demo_android.sh
endif
ifdef FLUTTER_VERSION
@docker run --rm -it -v $(shell pwd)/tools:/home/tools --workdir /home/tools \
--user=root:root \
--name flutter_$(FLUTTER_VERSION)_android_warmed \
xanter/flutter:$(FLUTTER_VERSION)-android-warmed sh /home/tools/build_demo_android.sh
endif