@@ -23,45 +23,43 @@ image_base="centos"
23
23
image_tag ="7"
24
24
iteration =0
25
25
26
- # todo: optimize the code, too much duplicate code now.
26
+ # ## function for building rpm
27
+ define build_rpm
28
+ docker build -t apache/$(1 ) :$(version ) --build-arg checkout_v=$(checkout ) \
29
+ -f ./dockerfiles/Dockerfile.$(2 ) .rpm .
30
+ endef
31
+
32
+ define package_rpm
33
+ docker build -t apache/$(1 ) -packaged:$(version ) \
34
+ --build-arg VERSION=$(version ) \
35
+ --build-arg ITERATION=$(iteration ) \
36
+ --build-arg PACKAGE_VERSION=$(version ) \
37
+ -f ./dockerfiles/Dockerfile.package.$(1 ) .
38
+ docker run -d --rm --name output --net="host" apache/$(1 ) -packaged:$(version )
39
+ docker cp output:/output ${PWD}
40
+ docker stop output
41
+ docker system prune -a -f
42
+ endef
27
43
28
44
# ## build apisix:
29
45
.PHONY : build-apisix-rpm
30
46
build-apisix-rpm :
31
- docker build -t apache/apisix:$(version ) --build-arg checkout_v=$(checkout ) \
32
- -f ./dockerfiles/Dockerfile.apisix.rpm .
47
+ $(call build_rpm,apisix,apisix)
33
48
34
49
# ## build rpm for apisix:
35
50
.PHONY : package-apisix-rpm
36
51
package-apisix-rpm :
37
- docker build -t apache/apisix-packaged:$(version ) \
38
- --build-arg VERSION=$(version ) \
39
- --build-arg ITERATION=$(iteration ) \
40
- --build-arg PACKAGE_VERSION=$(version ) \
41
- -f ./dockerfiles/Dockerfile.package.apisix .
42
- docker run -d --rm --name output --net=" host" apache/apisix-packaged:$(version )
43
- docker cp output:/output ${PWD}
44
- docker stop output
45
- docker system prune -a -f
52
+ $(call package_rpm,apisix)
46
53
47
54
# ## build dashboard:
48
55
.PHONY : build-dashboard-rpm
49
56
build-dashboard-rpm :
50
- docker build -t apache/apisix-dashboard:$(version ) --build-arg checkout_v=$(checkout ) \
51
- -f ./dockerfiles/Dockerfile.dashboard.rpm .
57
+ $(call build_rpm,apisix-dashboard,dashboard)
52
58
53
59
# ## build rpm for apisix dashboard:
54
60
.PHONY : package-dashboard-rpm
55
61
package-dashboard-rpm :
56
- docker build -t apache/apisix-dashboard-packaged:$(version ) \
57
- --build-arg VERSION=$(version ) \
58
- --build-arg ITERATION=$(iteration ) \
59
- --build-arg PACKAGE_VERSION=$(version ) \
60
- -f ./dockerfiles/Dockerfile.package.apisix-dashboard .
61
- docker run -d --rm --name output --net=" host" apache/apisix-dashboard-packaged:$(version )
62
- docker cp output:/output ${PWD}
63
- docker stop output
64
- docker system prune -a -f
62
+ $(call package_rpm,apisix-dashboard)
65
63
66
64
# ## build apisix-openresty:
67
65
.PHONY : build-apisix-openresty-rpm
@@ -72,16 +70,7 @@ build-apisix-openresty-rpm:
72
70
# ## build rpm for apisix-openresty:
73
71
.PHONY : package-apisix-openresty-rpm
74
72
package-apisix-openresty-rpm :
75
- docker build -t apache/apisix-openresty-packaged:$(version ) \
76
- --build-arg VERSION=$(version ) \
77
- --build-arg ITERATION=$(iteration ) \
78
- --build-arg PACKAGE_VERSION=$(version ) \
79
- -f ./dockerfiles/Dockerfile.package.apisix-openresty .
80
- docker run -d --rm --name output --net=" host" apache/apisix-openresty-packaged:$(version )
81
- docker cp output:/output ${PWD}
82
- docker stop output
83
- docker system prune -a -f
84
-
73
+ $(call package_rpm,apisix-openresty)
85
74
86
75
# ## build fpm for packaging:
87
76
.PHONY : build-fpm
0 commit comments