-
Notifications
You must be signed in to change notification settings - Fork 1
/
k8s.sh
43 lines (32 loc) · 949 Bytes
/
k8s.sh
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
#!/bin/sh
#set -e
echo "Build with Gradle"
chmod u+x gradlew
./gradlew clean assemble
echo "Build complete"
VERSION_NAME=v0.1
REPO_URL=xx.oo/xia
build_module() {
module=$1
port=$2
echo ">>> docker build $module"
pushd "$module"
docker images | grep "$module:$VERSION_NAME" | awk '{print $3}' | xargs docker rmi
docker build -t "$module:$VERSION_NAME" .
docker tag "$module:$VERSION_NAME" "$REPO_URL/$module:$VERSION_NAME"
popd
echo "<<< docker build $module"
}
build_module "ms-gateway" 8800
build_module "ms-customer" 8810
build_module "ms-provider" 8820
kubectl delete -f ms-k8s.yml
echo ">>> minikube load image"
minikube image load "$REPO_URL/ms-gateway:$VERSION_NAME"
minikube image load "$REPO_URL/ms-customer:$VERSION_NAME"
minikube image load "$REPO_URL/ms-provider:$VERSION_NAME"
echo "<<< minikube load image"
kubectl apply -f k8s.yml
sleep 10
minikube service ms-gateway-svc
echo "build and start success..."