From dbd648e2f72f2f540df4650a9a5a5169f1e79ed0 Mon Sep 17 00:00:00 2001 From: Ho Date: Tue, 11 Nov 2025 11:44:37 +0900 Subject: [PATCH] add image building action for proxy --- .github/workflows/docker.yml | 43 +++++++++++++++++++ .../dockerfiles/coordinator-proxy.Dockerfile | 26 +++++++++++ .../coordinator-proxy.Dockerfile.dockerignore | 8 ++++ 3 files changed, 77 insertions(+) create mode 100644 build/dockerfiles/coordinator-proxy.Dockerfile create mode 100644 build/dockerfiles/coordinator-proxy.Dockerfile.dockerignore diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bda9a0fe9..adfe5d56e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -360,6 +360,49 @@ jobs: scrolltech/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }} + coordinator-proxy: + runs-on: + group: scroll-reth-runner-group + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + - name: check repo and create it if not exist + env: + REPOSITORY: coordinator-proxy + run: | + aws --region ${{ env.AWS_REGION }} ecr describe-repositories --repository-names ${{ env.REPOSITORY }} && : || aws --region ${{ env.AWS_REGION }} ecr create-repository --repository-name ${{ env.REPOSITORY }} + - name: Build and push + uses: docker/build-push-action@v3 + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + REPOSITORY: coordinator-proxy + IMAGE_TAG: ${{ github.ref_name }} + with: + context: . + file: ./build/dockerfiles/coordinator-proxy.Dockerfile + push: true + tags: | + scrolltech/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }} + ${{ env.ECR_REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }} + coordinator-cron: runs-on: group: scroll-reth-runner-group diff --git a/build/dockerfiles/coordinator-proxy.Dockerfile b/build/dockerfiles/coordinator-proxy.Dockerfile new file mode 100644 index 000000000..0e76cff58 --- /dev/null +++ b/build/dockerfiles/coordinator-proxy.Dockerfile @@ -0,0 +1,26 @@ +# Download Go dependencies +FROM scrolltech/go-rust-builder:go-1.22.12-rust-nightly-2025-02-14 as base +WORKDIR /src +COPY go.work* ./ +COPY ./rollup/go.* ./rollup/ +COPY ./common/go.* ./common/ +COPY ./coordinator/go.* ./coordinator/ +COPY ./database/go.* ./database/ +COPY ./tests/integration-test/go.* ./tests/integration-test/ +COPY ./bridge-history-api/go.* ./bridge-history-api/ +RUN go mod download -x + + +# Build coordinator proxy +FROM base as builder +COPY . . +RUN cd ./coordinator && CGO_LDFLAGS="-Wl,--no-as-needed -ldl" make coordinator_proxy && mv ./build/bin/coordinator_proxy /bin/coordinator_proxy + +# Pull coordinator proxy into a second stage deploy ubuntu container +FROM ubuntu:20.04 +ENV CGO_LDFLAGS="-Wl,--no-as-needed -ldl" +RUN apt update && apt install vim netcat-openbsd net-tools curl jq -y +COPY --from=builder /bin/coordinator_proxy /bin/ +RUN /bin/coordinator_proxy --version +WORKDIR /app +ENTRYPOINT ["/bin/coordinator_proxy"] diff --git a/build/dockerfiles/coordinator-proxy.Dockerfile.dockerignore b/build/dockerfiles/coordinator-proxy.Dockerfile.dockerignore new file mode 100644 index 000000000..3fcfcdc46 --- /dev/null +++ b/build/dockerfiles/coordinator-proxy.Dockerfile.dockerignore @@ -0,0 +1,8 @@ +assets/ +contracts/ +docs/ +l2geth/ +rpc-gateway/ +*target/* + +permissionless-batches/conf/ \ No newline at end of file