请看文档
docker+jenkins+git搭建java自动化部署
补充点:
cd /Users/nhf/Documents/share
#/bin/bash ./run.sh
port=9999
kill -9 $(lsof -i:$port |awk '{print $2}' | tail -n 2)
chmod 777./target/demo-0.0.1-SNAPSHOT.jar
BUILD_ID=dontKillMe
nohup java -jar ./target/demo-0.0.1-SNAPSHOT.jar &
最后一步:利用gitlab的webhook触发jenkins