From 9f1835f0afa030875ddb4027e9d486571bd639c5 Mon Sep 17 00:00:00 2001 From: wo-o Date: Fri, 25 Oct 2024 16:22:54 +0900 Subject: [PATCH] dockerhub --- .github/workflows/ci-docker-hub-geth.yml | 62 ++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/ci-docker-hub-geth.yml diff --git a/.github/workflows/ci-docker-hub-geth.yml b/.github/workflows/ci-docker-hub-geth.yml new file mode 100644 index 000000000..b157bdc3e --- /dev/null +++ b/.github/workflows/ci-docker-hub-geth.yml @@ -0,0 +1,62 @@ +name: Build and Upload geth Binary to ECR + +on: + workflow_dispatch: + push: + branches: + - main + +env: + DOCKERHUB_REPOSITORY: jinnuae40/story-geth + +jobs: + # Build and upload the geth binary + build_and_push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 + + - name: Set build arguments + run: | + echo "COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "VERSION=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV + echo "BUILDNUM=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV + echo "REPOSITORY_URI=$DOCKERHUB_REPOSITORY" >> $GITHUB_ENV + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Dockerize the geth and bootnode binary + env: + DOCKER_BUILDKIT: 1 + run: | + docker buildx create --use + docker buildx build \ + --platform linux/amd64,linux/arm64,linux/arm64/v8 \ + --build-arg COMMIT=$COMMIT \ + --build-arg VERSION=$VERSION \ + --build-arg BUILDNUM=$BUILDNUM \ + -t $REPOSITORY_URI:latest \ + -t $REPOSITORY_URI:$COMMIT \ + -t $REPOSITORY_URI:$VERSION \ + --cache-from=type=local,src=/tmp/.buildx-cache \ + --cache-to=type=local,dest=/tmp/.buildx-cache \ + --push \ + -f ./Dockerfile \ + .