docker 构建jar 镜像

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;

posted @ 2020-09-18 16:32  冬天不眠  阅读(395)  评论(0编辑  收藏  举报