修改健康检查方式

This commit is contained in:
zk
2026-05-22 20:30:42 +08:00
parent 1191f85150
commit 3a1ba04ca5
3 changed files with 6 additions and 5 deletions
+3 -2
View File
@@ -19,7 +19,8 @@ RUN pnpm build
FROM nginx:alpine
ENV TZ=Asia/Shanghai
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& apk add --no-cache curl
# 拷贝构建产物
COPY --from=builder /build/dist /usr/share/nginx/html
@@ -30,6 +31,6 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget --spider -q http://localhost/ || exit 1
CMD curl -f http://localhost:80/ || exit 1
CMD ["nginx", "-g", "daemon off;"]
Vendored
+1 -1
View File
@@ -20,7 +20,7 @@ pipeline {
environment {
CONTAINER_PREFIX = 'offerpie-web' // 容器名前缀,拼接 -blue / -green / -nginx
HEALTH_URL = 'http://localhost/' // 前端静态页面健康检查
HEALTH_URL = 'http://localhost:80/' // 前端静态页面健康检查
}
stages {
+2 -2
View File
@@ -29,7 +29,7 @@ services:
- APP_VERSION=blue
- TZ=Asia/Shanghai
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost/"]
test: ["CMD", "curl", "-f", "http://localhost:80/"]
interval: 30s
timeout: 10s
retries: 3
@@ -50,7 +50,7 @@ services:
- APP_VERSION=green
- TZ=Asia/Shanghai
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost/"]
test: ["CMD", "curl", "-f", "http://localhost:80/"]
interval: 30s
timeout: 10s
retries: 3