From dc703e775ca82f64fbd174c7a06d79acfd7bbaa3 Mon Sep 17 00:00:00 2001 From: Matthieu Vachon Date: Wed, 11 Dec 2024 15:08:48 -0500 Subject: [PATCH] Upgrading GitHub CI to latest + bump to Ubuntu 22.04 --- .github/workflows/docker.yml | 31 ++++++++++++++++++------------- Dockerfile.github | 20 ++++++++++++++++---- docs/release-notes/change-log.md | 5 +++++ 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 07c9aa14f..d7924bc13 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,7 +3,7 @@ name: Build docker image on: push: tags: - - "[a-z0-9]+-v*" + - "v*" branches: - "dockerbuild" - "develop" @@ -16,7 +16,7 @@ env: jobs: build-and-push-image: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 if: "${{ !startsWith(github.event.head_commit.message, 'GitBook: [#') }}" permissions: contents: read @@ -24,18 +24,18 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version-file: './go.mod' - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: | - ~/go/pkg/mod ~/.cache/go-build + ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- @@ -43,8 +43,14 @@ jobs: - name: Build Binary run: go build -v -o ./substreams ./cmd/substreams + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -52,23 +58,22 @@ jobs: - name: Generate docker tags/labels from github build context id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=tag type=sha,prefix= type=raw,enable=${{ github.ref == 'refs/heads/develop' }},value=develop - type=raw,enable=${{ startsWith(github.ref, 'refs/heads/release/v') }},value=${{ steps.extract_branch.outputs.release_train }} + type=edge,branch=develop flavor: | latest=${{ startsWith(github.ref, 'refs/tags/') }} - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + uses: docker/build-push-action@v6 with: - context: . file: ./Dockerfile.github + platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} - # org.opencontainers.image.version will match the tag name labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile.github b/Dockerfile.github index f76b6914d..93e04be8d 100644 --- a/Dockerfile.github +++ b/Dockerfile.github @@ -1,7 +1,19 @@ -FROM ubuntu:20.04 +FROM --platform=$BUILDPLATFORM golang:1.23-bullseye AS build + +WORKDIR /src + +ARG TARGETOS TARGETARCH + +RUN --mount=target=. \ + --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/go/pkg \ + GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /app/substreams . + +FROM ubuntu:22.04 RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ - apt-get -y install -y ca-certificates libssl1.1 + apt-get -y install -y ca-certificates libssl3 + +COPY --from=build /app/substreams /app/substreams -ADD ./substreams /app/substreams -ENTRYPOINT /app/substreams +ENTRYPOINT ["/app/substreams"] diff --git a/docs/release-notes/change-log.md b/docs/release-notes/change-log.md index 4706f373c..6c2d51ecf 100644 --- a/docs/release-notes/change-log.md +++ b/docs/release-notes/change-log.md @@ -9,6 +9,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +* Substreams CLI is now built with using Ubuntu 22, previous releases were built using Ubuntu 20. +* Substreams Docker image is now using `ubuntu:22` as its base, previous releases were built using `ubuntu:20.04`. + ## v1.11.1 - Fix the `gui` breaking when the network field is not set in the spkg