#! /bin/bash
WORKDIR=/root/shengruikou/
cd $WORKDIR
# 如果不存在eurekaserverdemo目录
if [ ! -d "eurekaserverdemo" ]; then
echo "eurekaserverdemo not exists"
git clone git@github.com:koushr/eurekaserverdemo.git
fi
cd eurekaserverdemo
oldcommitid=`git rev-parse HEAD`
git pull
newcommitid=`git rev-parse HEAD`
if [[ "$oldcommitid" != "$newcommitid" || ! -f "target/" ]]; then
mvn clean package
fi
cp fsf.jar $WORKDIR
if [[ ! -d "/root/shengruikou/med" || ! -d "/root/shengruikou/med2" ]]; then
echo ""
else
echo "reuse old so files"
fi
find /root/shengruikou/p -name "*.py" ! -name "__init__.py" | xargs rm -rf
docker build -t 2p:0.1.4 -f /root/shengruikou/Dockerfile .
cat /root/shengruikou/password.txt | docker login --username shengruikou --password-stdin xxx.com
docker push 2p:0.1.4