From 454e5988ce768fe8815397e51ba7e68755f51ec7 Mon Sep 17 00:00:00 2001 From: chatton Date: Fri, 22 Aug 2025 15:02:25 +0200 Subject: [PATCH 1/4] chore: add second dockerfile and workflow to build the base ignite image --- .github/workflows/build-base-ignite-image.yml | 58 +++++++++++++++++++ Dockerfile | 21 ++----- Dockerfile.base | 29 ++++++++++ 3 files changed, 91 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/build-base-ignite-image.yml create mode 100644 Dockerfile.base diff --git a/.github/workflows/build-base-ignite-image.yml b/.github/workflows/build-base-ignite-image.yml new file mode 100644 index 00000000..1f2a0e8a --- /dev/null +++ b/.github/workflows/build-base-ignite-image.yml @@ -0,0 +1,58 @@ +name: Build Base Ignite Image +on: + workflow_dispatch: + inputs: + ignite_version: + description: "Ignite CLI version" + required: false + default: "v29.3.1" + type: string + ignite_evolve_app_version: + description: "Ignite Evolve app version/branch" + required: false + default: "main" + type: string + push: + paths: + - 'Dockerfile.base' + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-base-image: + name: Build and Push Base Ignite Image + runs-on: ubuntu-latest + timeout-minutes: 45 + env: + IGNITE_VERSION: ${{ inputs.ignite_version }} + IGNITE_EVOLVE_APP_VERSION: ${{ inputs.ignite_evolve_app_version }} + + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push Base Image + run: | + docker build \ + --build-arg IGNITE_VERSION=${{ env.IGNITE_VERSION }} \ + --build-arg IGNITE_EVOLVE_APP_VERSION=${{ env.IGNITE_EVOLVE_APP_VERSION }} \ + --label "ignite_version=${{ env.IGNITE_VERSION }}" \ + --label "ignite_evolve_app_version=${{ env.IGNITE_EVOLVE_APP_VERSION }}" \ + -t ghcr.io/evstack/base-ignite-image:latest \ + -f Dockerfile.base \ + --push . \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 76561fac..d4df12d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,16 @@ -FROM golang:1.24-alpine AS ignite-builder - -# Install dependencies needed for ignite and building -RUN apk add --no-cache \ - libc6-compat \ - curl \ - bash +ARG BASE_IMAGE=ghcr.io/evstack/base-ignite-image:latest +FROM ${BASE_IMAGE} AS ignite-builder # Set environment variables -ENV EVNODE_VERSION=v1.0.0-beta.2.0.20250818133040-d096a24e7052 -ENV IGNITE_VERSION=v29.3.1 -ENV IGNITE_EVOLVE_APP_VERSION=main - -RUN curl -sSL https://get.ignite.com/cli@${IGNITE_VERSION}! | bash +ARG EVNODE_VERSION=v1.0.0-beta.2.0.20250818133040-d096a24e7052 +ENV EVNODE_VERSION=${EVNODE_VERSION} WORKDIR /workspace COPY . ./ev-abci -RUN ignite scaffold chain gm --no-module --skip-git --address-prefix gm - WORKDIR /workspace/gm -RUN ignite app install github.com/ignite/apps/evolve@${IGNITE_EVOLVE_APP_VERSION} && \ - ignite evolve add - RUN go mod edit -replace github.com/evstack/ev-node=github.com/evstack/ev-node@${EVNODE_VERSION} && \ go mod edit -replace github.com/evstack/ev-abci=/workspace/ev-abci && \ go mod tidy diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 00000000..7caebfd8 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,29 @@ +FROM golang:1.24-alpine AS base-ignite-image + +# install dependencies needed for ignite and building +RUN apk add --no-cache \ + libc6-compat \ + curl \ + bash + +# set environment variables for ignite and evolve versions +ARG IGNITE_VERSION=v29.3.1 +ARG IGNITE_EVOLVE_APP_VERSION=main +ENV IGNITE_VERSION=${IGNITE_VERSION} +ENV IGNITE_EVOLVE_APP_VERSION=${IGNITE_EVOLVE_APP_VERSION} + +# install ignite CLI +RUN curl -sSL https://get.ignite.com/cli@${IGNITE_VERSION}! | bash + +WORKDIR /workspace + +# scaffold chain with evolve app +RUN ignite scaffold chain gm --no-module --skip-git --address-prefix gm + +WORKDIR /workspace/gm + +# install evolve app and add to chain +RUN ignite app install github.com/ignite/apps/evolve@${IGNITE_EVOLVE_APP_VERSION} && \ + ignite evolve add + +# this base image contains a pre-scaffolded chain with evolve From b225fe2c36b28f3539cad60756b3f924432b4b37 Mon Sep 17 00:00:00 2001 From: chatton Date: Fri, 22 Aug 2025 15:07:58 +0200 Subject: [PATCH 2/4] chore: run on prs which change the Dockerfile --- .github/workflows/build-base-ignite-image.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-base-ignite-image.yml b/.github/workflows/build-base-ignite-image.yml index 1f2a0e8a..22fd2f49 100644 --- a/.github/workflows/build-base-ignite-image.yml +++ b/.github/workflows/build-base-ignite-image.yml @@ -17,6 +17,9 @@ on: - 'Dockerfile.base' branches: - main + pull_request: + paths: + - 'Dockerfile.base' concurrency: group: ${{ github.workflow }}-${{ github.ref }} From b1a58add8ab6fab24b1a37092db2006cf4852b97 Mon Sep 17 00:00:00 2001 From: chatton Date: Fri, 22 Aug 2025 15:10:41 +0200 Subject: [PATCH 3/4] chore: correct defaults --- .github/workflows/build-base-ignite-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-base-ignite-image.yml b/.github/workflows/build-base-ignite-image.yml index 22fd2f49..21d59c9f 100644 --- a/.github/workflows/build-base-ignite-image.yml +++ b/.github/workflows/build-base-ignite-image.yml @@ -31,8 +31,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 45 env: - IGNITE_VERSION: ${{ inputs.ignite_version }} - IGNITE_EVOLVE_APP_VERSION: ${{ inputs.ignite_evolve_app_version }} + IGNITE_VERSION: ${{ inputs.ignite_version || 'v29.3.1' }} + IGNITE_EVOLVE_APP_VERSION: ${{ inputs.ignite_evolve_app_version || 'main' }} steps: - uses: actions/checkout@v5 From 7ce3e5e5cf3023a8e90869bece3cb9c643f01532 Mon Sep 17 00:00:00 2001 From: chatton Date: Fri, 22 Aug 2025 15:27:29 +0200 Subject: [PATCH 4/4] chore: cache dependencies --- Dockerfile.base | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile.base b/Dockerfile.base index 7caebfd8..350fac9a 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -26,4 +26,7 @@ WORKDIR /workspace/gm RUN ignite app install github.com/ignite/apps/evolve@${IGNITE_EVOLVE_APP_VERSION} && \ ignite evolve add +# pre-download dependencies to warm the module cache +RUN go mod download + # this base image contains a pre-scaffolded chain with evolve