jenkins docker

原创
2017/12/18 10:09
阅读数 83
  1. jenkins pre steps: execute shell:

    export PROCESS=$(docker ps -qa --filter name=PROJECT-v2)
    if [[ $PROCESS ]]; then
    docker stop $PROCESS
    docker rm    $PROCESS
    else
    echo "none"
    fi
    
  2. build: maven version: maven3.3.9 options: clean package -e -DskipTests=true

  3. post steps: execute shell:

cd target/
docker build . -t PROJECT-docker-v2:${BUILD_NUMBER} -f resources/Dockerfile
docker run -dit --name PROJECT-docker-v2 -v ${WORKSPACE}/target/resources:/PROJECT-v2/resources -p 8989:8989 PROJECT-v2:${BUILD_NUMBER} 
exit 0
展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部