From b19b2c885aabc9e5a1d2d289909f0de294e40fd4 Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Thu, 17 Oct 2024 17:27:16 +0800 Subject: [PATCH] fix docker --- Dockerfile | 26 ++++++++------------------ fetch.sh | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index eb985cd..e6a8d10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,6 @@ FROM golang:1.22.4-bullseye as build -# 构建 -# git clone https://source.quilibrium.com/quilibrium/ceremonyclient.git -# cd ceremonyclient -# curl -o Dockerfile https://raw.githubusercontent.com/lushdog/quil-docker/main/Dockerfile -# docker build -f Dockerfile --build-arg NODE_VERSION=1.4.19 --build-arg MAX_KEY_ID=13 -t quilibrium -t quilibrium:1.4.19 . - -ARG NODE_VERSION - -ENV GOEXPERIMENT=arenas - -WORKDIR /opt/ceremonyclient +WORKDIR /opt/node COPY . . @@ -20,9 +10,7 @@ RUN curl -o fetch.sh https://raw.githubusercontent.com/lushdog/quil-docker/refs/ RUN chmod +x node -WORKDIR /opt/ceremonyclient/client - -RUN go build -o qclient ./main.go +WORKDIR /opt/node RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@v1.9.1 @@ -30,11 +18,13 @@ FROM ubuntu:22.04 ENV GOEXPERIMENT=arenas -COPY --from=build /opt/ceremonyclient/node /usr/local/bin -COPY --from=build /opt/ceremonyclient/node.dgst /usr/local/bin -COPY --from=build /opt/ceremonyclient/node.dgst.sig.* /usr/local/bin +COPY --from=build /opt/node /usr/local/bin +COPY --from=build /opt/node.dgst /usr/local/bin +COPY --from=build /opt/node.dgst.sig.* /usr/local/bin -COPY --from=build /opt/ceremonyclient/client/qclient /usr/local/bin +COPY --from=build /opt/qclient /usr/local/bin +COPY --from=build /opt/qclient.dgst /usr/local/bin +COPY --from=build /opt/qclient.dgst.sig.* /usr/local/bin COPY --from=build /go/bin/grpcurl /usr/local/bin diff --git a/fetch.sh b/fetch.sh index 83dc662..78e6937 100644 --- a/fetch.sh +++ b/fetch.sh @@ -19,3 +19,26 @@ fetch() { done } fetch + +fetchQclient() { + files=$(curl https://releases.quilibrium.com/qclient-release | grep linux-amd64) + new_release=false + + for file in $files; do + # 下载文件 + if ! test -f "./$file"; then + curl "https://releases.quilibrium.com/$file" > "$file" + new_release=true + + # 使用正则表达式匹配,替换掉前缀部分为 'node' + new_name=$(echo "$file" | sed 's/qclient-.*-linux-amd64/qclient/') + + # 只有当文件名不同的时候才执行重命名 + if [[ "$file" != "$new_name" ]]; then + mv "$file" "$new_name" + fi + fi + done +} + +fetchQclient