fix(ci): 修复部署流水线配置
- 使用 Git commit hash 作为镜像标签 - 增加健康检查超时到 15 秒 - 添加镜像清理阶段(保留 7 天) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Vendored
+8
-2
@@ -1,7 +1,7 @@
|
||||
pipeline {
|
||||
agent none
|
||||
environment {
|
||||
IMAGE_NAME = 'lpt-fe:0.0'
|
||||
IMAGE_NAME = "lpt-fe:${env.GIT_COMMIT?.take(8) ?: '0.0'}"
|
||||
CONTAINER_NAME = 'LPT_FE'
|
||||
CONTAINER_PORT = '80'
|
||||
}
|
||||
@@ -34,7 +34,13 @@ pipeline {
|
||||
stage('健康检查') {
|
||||
agent any
|
||||
steps {
|
||||
sh 'sleep 5 && docker exec $CONTAINER_NAME curl -f http://localhost:$CONTAINER_PORT/ || (docker logs $CONTAINER_NAME && exit 1)'
|
||||
sh 'sleep 15 && docker exec $CONTAINER_NAME curl -f http://localhost:$CONTAINER_PORT/ || (docker logs $CONTAINER_NAME && exit 1)'
|
||||
}
|
||||
}
|
||||
stage('清理旧镜像') {
|
||||
agent any
|
||||
steps {
|
||||
sh 'docker image prune -af --filter "until=168h" || true'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user