feat:加入健康检查
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
# 安装 curl 用于健康检查
|
||||||
|
RUN apk add --no-cache curl
|
||||||
|
|
||||||
COPY dist/ /usr/share/nginx/html/
|
COPY dist/ /usr/share/nginx/html/
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
Vendored
+17
@@ -57,5 +57,22 @@ pipeline {
|
|||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage('Run Docker Container') {
|
||||||
|
agent any
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
docker rm -f $CONTAINER_NAME || true
|
||||||
|
docker run -d --name $CONTAINER_NAME \\
|
||||||
|
-p $HOST_PORT:$CONTAINER_PORT \\
|
||||||
|
--health-cmd="curl -f http://localhost:$CONTAINER_PORT || exit 1" \\
|
||||||
|
--health-interval=10s \\
|
||||||
|
--health-timeout=5s \\
|
||||||
|
--health-retries=3 \\
|
||||||
|
$IMAGE_NAME
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user