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:
Developer 2025-12-03 17:23:17 -08:00
parent b1f3a02fb0
commit 1700b8b57c
4 changed files with 12 additions and 9 deletions

View File

@ -23,7 +23,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
# Final stage
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
COPY --from=builder /bin/account-service /bin/account-service
@ -32,7 +32,8 @@ USER mpc
EXPOSE 50051 8080
# Health check
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"]

View File

@ -23,7 +23,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
# Final stage
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
COPY --from=builder /bin/message-router /bin/message-router
@ -32,7 +32,8 @@ USER mpc
EXPOSE 50051 8080
# Health check
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"]

View File

@ -23,7 +23,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
# Final stage
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
COPY --from=builder /bin/server-party /bin/server-party
@ -32,7 +32,8 @@ USER mpc
EXPOSE 50051 8080
# Health check
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"]

View File

@ -30,8 +30,8 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
# Final stage
FROM alpine:3.18
# Install ca-certificates for HTTPS
RUN apk --no-cache add ca-certificates wget
# Install ca-certificates and curl for HTTPS and health check
RUN apk --no-cache add ca-certificates curl
# Create non-root user
RUN adduser -D -s /bin/sh mpc
@ -47,7 +47,7 @@ EXPOSE 50051 8080
# Health check
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
ENTRYPOINT ["/bin/session-coordinator"]