dockerhub #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 \ | |
. |