feat:增加健康检查
This commit is contained in:
@@ -12,3 +12,6 @@ EXPOSE 5157
|
||||
|
||||
# 启动应用
|
||||
ENTRYPOINT ["java", "-jar", "LPT.jar"]
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK --interval=10s --timeout=5s CMD curl --fail http://localhost:5157/actuator/health || exit 1
|
||||
|
||||
Vendored
+18
@@ -37,5 +37,23 @@ pipeline {
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Check Docker Status') {
|
||||
agent any
|
||||
steps {
|
||||
script {
|
||||
timeout(time: 60, unit: 'SECONDS') {
|
||||
waitUntil {
|
||||
def status = sh(
|
||||
script: "docker inspect -f '{{.State.Health.Status}}' $CONTAINER_NAME || echo 'unhealthy'",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
echo "Current container status: ${status}"
|
||||
return (status == 'healthy')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user