diff --git a/Dockerfile b/Dockerfile index 2c56e56..18c968a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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;"] diff --git a/Jenkinsfile b/Jenkinsfile index c03615a..547f470 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { environment { CONTAINER_PREFIX = 'offerpie-web' // 容器名前缀,拼接 -blue / -green / -nginx - HEALTH_URL = 'http://localhost/' // 前端静态页面健康检查 + HEALTH_URL = 'http://localhost:80/' // 前端静态页面健康检查 } stages { diff --git a/docker-compose.yml b/docker-compose.yml index c0320c4..3d9d4e1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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