diff --git a/dockerfiles/migration/Dockerfile b/dockerfiles/migration/Dockerfile index 0281813d..f2aa1bea 100644 --- a/dockerfiles/migration/Dockerfile +++ b/dockerfiles/migration/Dockerfile @@ -11,6 +11,7 @@ RUN chmod +x /workspace/script/wait-for-clickhouse.sh # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details FROM golang:alpine +RUN apk add --no-cache netcat-openbsd WORKDIR / COPY --from=builder /workspace/migration . COPY --from=builder /workspace/sql /sql diff --git a/script/wait-for-clickhouse.sh b/script/wait-for-clickhouse.sh index 26555ec3..9d7b4692 100644 --- a/script/wait-for-clickhouse.sh +++ b/script/wait-for-clickhouse.sh @@ -7,7 +7,7 @@ MAX_RETRIES=60 retry_count=0 while [ $retry_count -lt $MAX_RETRIES ]; do - if clickhouse-client --host $CLICKHOUSE_HOST --port $CLICKHOUSE_PORT --query "SELECT 1"; then + if nc -z -v -w5 $CLICKHOUSE_HOST $CLICKHOUSE_PORT; then echo "ClickHouse is ready!" exit 0 else