diff --git a/.github/workflows/build-base-ignite-image.yml b/.github/workflows/build-base-ignite-image.yml new file mode 100644 index 00000000..21d59c9f --- /dev/null +++ b/.github/workflows/build-base-ignite-image.yml @@ -0,0 +1,61 @@ +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 + pull_request: + paths: + - 'Dockerfile.base' + +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 || 'v29.3.1' }} + IGNITE_EVOLVE_APP_VERSION: ${{ inputs.ignite_evolve_app_version || 'main' }} + + 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..350fac9a --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,32 @@ +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 + +# pre-download dependencies to warm the module cache +RUN go mod download + +# this base image contains a pre-scaffolded chain with evolve