fix(mpc-system): 使用 curl 进行健康检查
- 将 wget --spider (HEAD 请求) 改为 curl -sf (GET 请求) - Gin 路由只响应 GET 请求,HEAD 请求返回 404 - 安装 curl 替代 wget 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b1f3a02fb0
commit
1700b8b57c
|
|
@ -23,7 +23,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
# Final stage
|
# Final stage
|
||||||
FROM alpine:3.18
|
FROM alpine:3.18
|
||||||
|
|
||||||
RUN apk --no-cache add ca-certificates wget
|
RUN apk --no-cache add ca-certificates curl
|
||||||
RUN adduser -D -s /bin/sh mpc
|
RUN adduser -D -s /bin/sh mpc
|
||||||
|
|
||||||
COPY --from=builder /bin/account-service /bin/account-service
|
COPY --from=builder /bin/account-service /bin/account-service
|
||||||
|
|
@ -32,7 +32,8 @@ USER mpc
|
||||||
|
|
||||||
EXPOSE 50051 8080
|
EXPOSE 50051 8080
|
||||||
|
|
||||||
|
# Health check
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||||
CMD wget -q --spider http://localhost:8080/health || exit 1
|
CMD curl -sf http://localhost:8080/health || exit 1
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/account-service"]
|
ENTRYPOINT ["/bin/account-service"]
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
# Final stage
|
# Final stage
|
||||||
FROM alpine:3.18
|
FROM alpine:3.18
|
||||||
|
|
||||||
RUN apk --no-cache add ca-certificates wget
|
RUN apk --no-cache add ca-certificates curl
|
||||||
RUN adduser -D -s /bin/sh mpc
|
RUN adduser -D -s /bin/sh mpc
|
||||||
|
|
||||||
COPY --from=builder /bin/message-router /bin/message-router
|
COPY --from=builder /bin/message-router /bin/message-router
|
||||||
|
|
@ -32,7 +32,8 @@ USER mpc
|
||||||
|
|
||||||
EXPOSE 50051 8080
|
EXPOSE 50051 8080
|
||||||
|
|
||||||
|
# Health check
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||||
CMD wget -q --spider http://localhost:8080/health || exit 1
|
CMD curl -sf http://localhost:8080/health || exit 1
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/message-router"]
|
ENTRYPOINT ["/bin/message-router"]
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
# Final stage
|
# Final stage
|
||||||
FROM alpine:3.18
|
FROM alpine:3.18
|
||||||
|
|
||||||
RUN apk --no-cache add ca-certificates wget
|
RUN apk --no-cache add ca-certificates curl
|
||||||
RUN adduser -D -s /bin/sh mpc
|
RUN adduser -D -s /bin/sh mpc
|
||||||
|
|
||||||
COPY --from=builder /bin/server-party /bin/server-party
|
COPY --from=builder /bin/server-party /bin/server-party
|
||||||
|
|
@ -32,7 +32,8 @@ USER mpc
|
||||||
|
|
||||||
EXPOSE 50051 8080
|
EXPOSE 50051 8080
|
||||||
|
|
||||||
|
# Health check
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||||
CMD wget -q --spider http://localhost:8080/health || exit 1
|
CMD curl -sf http://localhost:8080/health || exit 1
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/server-party"]
|
ENTRYPOINT ["/bin/server-party"]
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
# Final stage
|
# Final stage
|
||||||
FROM alpine:3.18
|
FROM alpine:3.18
|
||||||
|
|
||||||
# Install ca-certificates for HTTPS
|
# Install ca-certificates and curl for HTTPS and health check
|
||||||
RUN apk --no-cache add ca-certificates wget
|
RUN apk --no-cache add ca-certificates curl
|
||||||
|
|
||||||
# Create non-root user
|
# Create non-root user
|
||||||
RUN adduser -D -s /bin/sh mpc
|
RUN adduser -D -s /bin/sh mpc
|
||||||
|
|
@ -47,7 +47,7 @@ EXPOSE 50051 8080
|
||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||||
CMD wget -q --spider http://localhost:8080/health || exit 1
|
CMD curl -sf http://localhost:8080/health || exit 1
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
ENTRYPOINT ["/bin/session-coordinator"]
|
ENTRYPOINT ["/bin/session-coordinator"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue