forked from primihub/primihub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_local.sh
43 lines (31 loc) · 830 Bytes
/
build_local.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/bash
if [ ! -n "$1" ] ; then
echo "Please input 1st arg: docker image tag"
exit
fi
bash pre_build.sh
#build
bazel build --config=linux :node :cli :opt_paillier_c2py
if [ $? -ne 0 ]; then
echo "Build failed!!!"
exit
fi
BASE_DIR=`ls -l | grep bazel-bin | awk '{print $11}'`
if [ ! -d "$BASE_DIR" ]; then
echo "BASE_DIR IS NULL"
exit
fi
IMAGE_NAME="primihub/primihub-node"
sed -i "12c ARG TARGET_PATH=$BASE_DIR" Dockerfile.local
rm -rf $BASE_DIR/python $BASE_DIR/config
rm -f $BASE_DIR/Dockerfile.local
rm -f $BASE_DIR/.dockerignore
rm -rf $BASE_DIR/data
cp -r ./data $BASE_DIR/
cp -r ./python $BASE_DIR/
cp -r ./config $BASE_DIR/
cp ./Dockerfile.local $BASE_DIR/
cp -r ./src $BASE_DIR/
cd $BASE_DIR
find ./ -name "_objs" > .dockerignore
docker build -t $IMAGE_NAME:$1 . -f Dockerfile.local