docker 构建jar 镜像
1
IMAGE="test-data-ingestion-hub"
cd dih-server
mkdir -p target/docker/
#sh /home/admin/data/config/preBuild-jar.sh dih-server
mv target/dih-server.jar target/docker/app.jar
cp /home/admin/data/config/Dockerfile-jar target/docker/
docker login -u ${d_uname} -p ${d_pwd} ${d_reg}
docker build -t ${d_reg}/${d_ns}/$IMAGE -f ./target/docker/Dockerfile-jar target/docker
docker push ${d_reg}/${d_ns}/$IMAGE:latest ;
IMAGE="test-data-ingestion-hub"
PORT=8100
docker login -u ${d_uname} -p ${d_pwd} ${d_reg}
docker pull ${d_reg}/${d_ns}/$IMAGE:latest
docker container ps -all --filter "name=$IMAGE" --format {{.ID}} |xargs --no-run-if-empty docker container stop
docker container ps -all --filter "name=$IMAGE" --format {{.ID}} |xargs --no-run-if-empty docker container rm
docker run --restart always --name $IMAGE -p 8101:9877 -p $PORT:8090\
-v /home/admin/data/uploads/$IMAGE/:/usr/local/tomcat/uploads/ \
-v /home/admin/logs/hubdata/:/home/admin/logs/hubdata/ \
-d ${d_reg}/${d_ns}/$IMAGE:latest;