From e19690c9767f4974c0e89cf15942c2fe1e494e2d Mon Sep 17 00:00:00 2001 From: jesse snyder Date: Mon, 17 Apr 2023 13:22:53 -0500 Subject: [PATCH] fix arm builds. only build arm for tags and merges to default branch. (#12) * fix arm builds. only build arm for tags and merges to default branch. * fix gh action function syntax * more correct comment * build for semver tags --- .../astria-build-and-publish-image.yml | 18 +++++++++++------- Dockerfile | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/astria-build-and-publish-image.yml b/.github/workflows/astria-build-and-publish-image.yml index 41c2c66769..2677fd25f2 100644 --- a/.github/workflows/astria-build-and-publish-image.yml +++ b/.github/workflows/astria-build-and-publish-image.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: # Checking out the repo - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # Setting up Go - uses: actions/setup-go@v4 with: @@ -30,13 +30,17 @@ jobs: # https://github.com/docker/setup-qemu-action - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 # https://github.com/docker/setup-buildx-action - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v1 - - name: Log in to registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + uses: docker/setup-buildx-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} # Generate correct tabs and labels - name: Docker metadata id: metadata @@ -54,8 +58,8 @@ jobs: uses: docker/build-push-action@v4 with: context: . - # It takes over 30 minutes to build the arm image right now, so we only build it on tags which is what we use for releases. - platforms: ${{ contains(github.ref, 'refs/tags/v') && 'linux/amd64,linux/arm64' || 'linux/amd64' }} + # It takes a long time to build the arm image right now, so we only build it on tags which is what we use for releases, or on merges to the default branch. + platforms: ${{ (contains(github.ref, 'refs/tags/v') || github.ref == join('refs/heads/', github.event.repository.default_branch)) && 'linux/amd64,linux/arm64' || 'linux/amd64' }} push: true tags: ${{ steps.metadata.outputs.tags }} labels: ${{ steps.metadata.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 9c99146d3e..ce3414df97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ ARG VERSION="" ARG BUILDNUM="" # Build Geth in a stock Go builder container -FROM --platform=$BUILDPLATFORM golang:1.20-alpine as builder +FROM golang:1.20-alpine as builder RUN apk add --no-cache gcc musl-dev linux-headers git @@ -17,7 +17,7 @@ ADD . /go-ethereum RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth # Pull Geth into a second stage deploy alpine container -FROM --platform=$BUILDPLATFORM alpine:latest +FROM alpine:latest RUN apk add --no-cache ca-certificates # Astria - add bash and jq to support start-geth.sh in conductor