-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile.docker
133 lines (104 loc) · 4.9 KB
/
Makefile.docker
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
include variables.mk
####################
### Build images ###
####################
images: image-drivemgr \
image-node \
image-controller \
image-extender \
image-extender-patcher \
image-node-controller
# image-scheduler \
base-images: base-image-drivemgr base-image-node base-image-controller
base-image-drivemgr:
docker build --network host --file ./pkg/${DRIVE_MANAGER}/${DRIVE_MANAGER_TYPE}/Dockerfile.build \
--tag ${DRIVE_MANAGER_TYPE}:base ./pkg/${DRIVE_MANAGER}/${DRIVE_MANAGER_TYPE} \
${BASE_IMAGE_DRIVEMGR_ARGS_${shell echo $(DRIVE_MANAGER_TYPE) | tr '[a-z]' '[A-Z]'}}
download-grpc-health-probe:
mkdir -p build
if [ ! -s build/health_probe ]; then curl -L ${HEALTH_PROBE_BIN_URL} -o build/health_probe; fi
chmod +x build/health_probe
# NOTE: Output directory for binary file should be in Docker context.
# So we can't use csi-baremetal/build to build the image.
base-image-node:
cp ./pkg/${NODE}/Dockerfile* ./build/${NODE}/
cp ./build/${HEALTH_PROBE} ./build/${NODE}/
docker build --network host --file ./build/${NODE}/Dockerfile.build --tag ${NODE}:base ./build/${NODE}
docker build --network host --file ./build/${NODE}/Dockerfile-kernel-5.4.build --tag ${NODE}:base-kernel-5.4 ./build/${NODE}
base-image-controller:
cp ./pkg/${CONTROLLER}/Dockerfile.build ./build/${CONTROLLER}/
cp ./build/${HEALTH_PROBE} ./build/${CONTROLLER}/
docker build --network host --file ./build/${CONTROLLER}/Dockerfile.build --tag ${CONTROLLER}:base ./build/${CONTROLLER}
image-drivemgr: base-image-drivemgr
cp ./pkg/${DRIVE_MANAGER}/${DRIVE_MANAGER_TYPE}/Dockerfile ./build/${DRIVE_MANAGER}/${DRIVE_MANAGER_TYPE}/
docker build --network host --force-rm --tag ${REGISTRY}/${PROJECT}-${DRIVE_MANAGER_TYPE}:${TAG} ./build/${DRIVE_MANAGER}/${DRIVE_MANAGER_TYPE}
image-node: base-image-node
cp ./pkg/${NODE}/Dockerfile* ./build/${NODE}/
docker build --network host --force-rm --tag ${REGISTRY}/${PROJECT}-${NODE}:${TAG} ./build/${NODE}
docker build --network host --force-rm --file ./build/${NODE}/Dockerfile-kernel-5.4 --tag ${REGISTRY}/${PROJECT}-${NODE}-kernel-5.4:${TAG} ./build/${NODE}
image-controller: base-image-controller
cp ./pkg/${CONTROLLER}/Dockerfile ./build/${CONTROLLER}/
docker build --network host --force-rm --tag ${REGISTRY}/${PROJECT}-${CONTROLLER}:${TAG} ./build/${CONTROLLER}
image-extender:
cp ./pkg/${SCHEDULER}/${EXTENDER}/Dockerfile ./build/${SCHEDULING_PKG}/${EXTENDER}/
cp ./build/${HEALTH_PROBE} ./build/${SCHEDULING_PKG}/${EXTENDER}/
docker build --network host --force-rm --tag ${REGISTRY}/${PROJECT}-${SCHEDULER}-${EXTENDER}:${TAG} ./build/${SCHEDULING_PKG}/${EXTENDER}
image-extender-patcher:
docker build --network host --force-rm --tag ${REGISTRY}/${PROJECT}-${EXTENDER_PATCHER}:${TAG} ./pkg/${SCHEDULER_EXTENDER_PATCHER_PKG}
# image-scheduler:
# cp ./pkg/${SCHEDULER}/${PLUGIN}/Dockerfile ./build/${SCHEDULING_PKG}/${SCHEDULER}/
# docker build --network host --force-rm --tag ${REGISTRY}/${PROJECT}-${SCHEDULER}:${TAG} ./build/${SCHEDULING_PKG}/${SCHEDULER}
image-node-controller:
cp ./pkg/${CR_CONTROLLERS}/${NODE_CONTROLLER_PKG}/Dockerfile ./build/${CR_CONTROLLERS}/${NODE_CONTROLLER}/
docker build --network host --force-rm --tag ${REGISTRY}/${PROJECT}-${NODE_CONTROLLER}:${TAG} \
./build/${CR_CONTROLLERS}/${NODE_CONTROLLER}
###################
### Push images ###
###################
push: push-drivemgr \
push-node \
push-controller \
push-extender \
push-extender-patcher \
push-node-controller
# push-scheduler \
push-drivemgr:
docker push ${REGISTRY}/${PROJECT}-${DRIVE_MANAGER_TYPE}:${TAG}
push-node:
docker push ${REGISTRY}/${PROJECT}-${NODE}:${TAG}
docker push ${REGISTRY}/${PROJECT}-${NODE}-kernel-5.4:${TAG}
push-controller:
docker push ${REGISTRY}/${PROJECT}-${CONTROLLER}:${TAG}
push-extender:
docker push ${REGISTRY}/${PROJECT}-${SCHEDULER}-${EXTENDER}:${TAG}
push-extender-patcher:
docker push ${REGISTRY}/${PROJECT}-${EXTENDER_PATCHER}:${TAG}
# push-scheduler:
# docker push ${REGISTRY}/${PROJECT}-${SCHEDULER}:${TAG}
push-node-controller:
docker push ${REGISTRY}/${PROJECT}-${NODE_CONTROLLER}:${TAG}
####################
### Clean images ###
####################
clean-images: clean-image-node \
clean-image-controller \
clean-image-drivemgr \
clean-image-extender \
clean-image-extender-patcher \
clean-image-node-controller
# clean-image-scheduler \
clean-image-drivemgr:
docker rmi ${REGISTRY}/${PROJECT}-${DRIVE_MANAGER_TYPE}:${TAG}
clean-image-node:
docker rmi ${REGISTRY}/${PROJECT}-${NODE}:${TAG}
docker rmi ${REGISTRY}/${PROJECT}-${NODE}-kernel-5.4:${TAG}
clean-image-controller:
docker rmi ${REGISTRY}/${PROJECT}-${CONTROLLER}:${TAG}
clean-image-extender:
docker rmi ${REGISTRY}/${PROJECT}-${SCHEDULER}-${EXTENDER}:${TAG}
clean-image-extender-patcher:
docker rmi ${REGISTRY}/${PROJECT}-${EXTENDER_PATCHER}:${TAG}
# clean-image-scheduler:
# docker rmi ${REGISTRY}/${PROJECT}-${SCHEDULER}:${TAG}
clean-image-node-controller:
docker rmi ${REGISTRY}/${PROJECT}-${NODE_CONTROLLER}:${TAG}