完善打包脚本

This commit is contained in:
2023-08-09 16:06:36 +08:00
parent 479377eb6c
commit f8659a7911

22
Jenkinsfile vendored
View File

@@ -26,29 +26,43 @@ pipeline{
}
stage("关闭 docker-compose"){
stage("打标签"){
steps{
sh "docker-compose --project-directory docker/${env.BRANCH_NAME} down || true"
sh "docker tag coal:${env.BRANCH_NAME} 192.168.0.118/coal/coal:${env.BRANCH_NAME}"
}
}
stage("启动 docker-compose"){
stage("推送到仓库"){
steps{
sh "docker-compose --project-name ${env.JOB_NAME.replace('/', '_')} --project-directory docker/${env.BRANCH_NAME} up -d"
sh "docker push 192.168.0.118/coal/coal:${env.BRANCH_NAME}"
}
}
stage("清理无用的层"){
steps{
sh "docker image prune -f"
}
}
}