Skip to content

Build image with dfuse-esoio:'v3.2.0-1.0.7' and eosio:'5.0.2-3.0.0' #222

Build image with dfuse-esoio:'v3.2.0-1.0.7' and eosio:'5.0.2-3.0.0'

Build image with dfuse-esoio:'v3.2.0-1.0.7' and eosio:'5.0.2-3.0.0' #222

Workflow file for this run

name: Docker Image CI
run-name: Build image with dfuse-esoio:'${{ github.event.inputs.dfuse-eosio }}' and eosio:'${{ github.event.inputs.eosio }}'
on:
# Only allows triggering through the Github Workflow UI
workflow_dispatch:
inputs:
dfuse-eosio:
description: Tag from dfuse-eosio
required: true
type: string
eosio:
description: Tag from eosio
default: 'null'
required: false
type: string
overwrite-dfuse:
description: Overwrite existed dfuse Image.
default: false
type: boolean
ubuntu-version:
description: Specific Ubuntu version.
default: '22.04'
type: choice
options:
- '22.04'
- '18.04'
env:
DOCKER_IMAGE: europe-west1-docker.pkg.dev/ultra-registry/docker/dfuse-eosio
jobs:
build:
name: Build and Push image
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Set Dfuse Version
run: |
echo "DFUSE_TAG=${{ github.event.inputs.dfuse-eosio }}" >> $GITHUB_ENV
echo "UBUNTU_VERSION=${{ github.event.inputs.ubuntu-version }}" >> $GITHUB_ENV
- name: Set Nodeos Version
if: ${{ github.event.inputs.eosio != 'null' }}
run: |
echo "EOSIO_TAG=${{ github.event.inputs.eosio }}" >> $GITHUB_ENV
echo "DFUSE_NODEOS_TAG=${{ github.event.inputs.dfuse-eosio }}-nodeos${{ github.event.inputs.eosio }}" >> $GITHUB_ENV
# checkout based on dfuse tag
- name: Checkout dfuse-eosio
uses: actions/checkout@v3
with:
ref: "${{ env.DFUSE_TAG }}"
# check release commit
- name: Update Commit Hash
run: |
echo "RELEASE_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# Only download eosio if set
- name: Download EOSIO Debian package
if: ${{ github.event.inputs.eosio != 'null' }}
uses: Legion2/[email protected]
with:
repository: ultraio/eosio
tag: '${{ github.event.inputs.eosio }}'
path: .
file: eosio-${{ env.EOSIO_TAG }}.deb
token: '${{ secrets.DEVOPS_SECRET }}'
# gcloud authorization
# - id: 'auth'
# uses: 'google-github-actions/auth@v1'
# with:
# credentials_json: '${{ secrets.GCR_KEY }}'
#
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
token_format: 'access_token'
workload_identity_provider: '${{ secrets.REG_WIF }}'
service_account: '[email protected]'
- name: Setup gcloud cli
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ultra-registry
- name: 'Login to GAR'
uses: docker/login-action@v2
with:
registry: europe-west1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
# # docker gcloud config
# - name: Docker config
# run: |
# gcloud auth configure-docker europe-west1-docker.pkg.dev -q
# Check if dfuse image is existed. Failed if not existed
- name: Check Dfuse Image
id: dfuse-check
continue-on-error: true
run: |
docker manifest inspect ${{ env.DOCKER_IMAGE }}:${{ env.DFUSE_TAG }}
# Only build dfuse image if not existed or overwrite is set
- name: Build Dfuse Image Without Nodeos
if: ${{ (steps.dfuse-check.outcome == 'failure' || github.event.inputs.overwrite-dfuse == 'true') }}
run: |
docker build -f dfuse.Dockerfile . -t ${{ env.DOCKER_IMAGE }}:${{ env.DFUSE_TAG }} \
--build-arg VERSION=${{ env.DFUSE_TAG }} \
--build-arg COMMIT=${{ env.RELEASE_COMMIT }} \
--build-arg UBUNTU_VERSION=${{ env.UBUNTU_VERSION }}
docker push ${{ env.DOCKER_IMAGE }}:${{ env.DFUSE_TAG }}
# Only build dfuse with nodeos if eosio is set and dfuse image are exist
- name: Build Dfuse Image With Nodeos
if: ${{ github.event.inputs.eosio != 'null' }}
run: |
docker build -f nodeos.Dockerfile . -t ${{ env.DOCKER_IMAGE }}:${{ env.DFUSE_NODEOS_TAG }} \
--build-arg DFUSE_IMAGE=${{ env.DOCKER_IMAGE }}:${{ env.DFUSE_TAG }} \
--build-arg DEB_PKG=eosio-${{ env.EOSIO_TAG }}.deb
docker push ${{ env.DOCKER_IMAGE }}:${{ env.DFUSE_NODEOS_TAG }}