Skip to content

Commit 969871e

Browse files
author
Yasir
authored
Merge pull request #118 from bitfinity-network/update-CI
Add CI for publishing images to GCP
2 parents 861756c + d1d136b commit 969871e

3 files changed

Lines changed: 54 additions & 30 deletions

File tree

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Deploy EVM Block Extractor docker image'
1+
name: 'Deploy EVM Block Extractor Docker Image'
22

33
on:
44
workflow_dispatch: {}
@@ -8,46 +8,72 @@ on:
88
tags:
99
- 'v*'
1010

11+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
12+
permissions:
13+
contents: read
14+
packages: write
15+
1116
concurrency:
1217
group: ${{ github.workflow }}-${{ github.ref }}
1318
cancel-in-progress: true
1419

15-
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
1620
env:
17-
REGISTRY: ghcr.io
18-
IMAGE_NAME: ${{github.repository_owner}}/evm-block-extractor
21+
IMAGE_NAME: evm-block-extractor
22+
GCP_REGISTRY: us-east4-docker.pkg.dev
1923

20-
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
2124
jobs:
22-
build-and-push-image:
25+
deploy-to-github:
2326
runs-on: ubuntu-latest
24-
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
25-
permissions:
26-
contents: read
27-
packages: write
28-
#
27+
2928
steps:
3029
- name: Checkout repository
31-
uses: actions/checkout@v4
30+
uses: actions/checkout@v3
3231

33-
- name: Log in to the Container registry
32+
- name: Log in to GitHub Container Registry
3433
uses: docker/login-action@v3
3534
with:
36-
registry: ${{ env.REGISTRY }}
35+
registry: ghcr.io
3736
username: ${{ github.actor }}
3837
password: ${{ secrets.GITHUB_TOKEN }}
3938

4039
- name: Extract metadata (tags, labels) for Docker
41-
id: meta
40+
id: gh-meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
44+
45+
- name: Build and push Docker image to GitHub Container Registry
46+
uses: docker/build-push-action@v5
47+
with:
48+
context: .
49+
file: ./src/evm-block-extractor/Dockerfile
50+
push: true
51+
tags: ${{ steps.gh-meta.outputs.tags }}
52+
53+
deploy-to-gcp:
54+
runs-on: ubuntu-latest
55+
needs: deploy-to-github
56+
steps:
57+
- name: Checkout repository
58+
uses: actions/checkout@v3
59+
60+
- name: Log in to GCP Registry
61+
uses: docker/login-action@v3
62+
with:
63+
registry: ${{env.GCP_REGISTRY}}
64+
username: _json_key
65+
password: ${{ secrets.EXTRACTOR_GCP_DOCKER_KEY }}
66+
67+
- name: Extract metadata (tags, labels) for Docker
68+
id: gcp-meta
4269
uses: docker/metadata-action@v5
4370
with:
44-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
71+
images: ${{env.GCP_REGISTRY}}/extractor-410310/block-extractor-repo/${{ env.IMAGE_NAME }}
4572

46-
- name: Build and push Docker image
73+
- name: Build and push Docker image to GCP Registry
4774
uses: docker/build-push-action@v5
4875
with:
4976
context: .
5077
file: ./src/evm-block-extractor/Dockerfile
5178
push: true
52-
tags: ${{ steps.meta.outputs.tags }}
53-
# labels: ${{ steps.meta.outputs.labels }}
79+
tags: ${{ steps.gcp-meta.outputs.tags }}

docker-compose.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
1-
version: "3.3"
1+
version: '3.3'
22

33
#
44
# This docker-compose file is used to start the services for local testing.
55
# It starts a evm-blockchain-extractor connected to a local postgres database.
66
#
77

88
services:
9-
109
db:
11-
image: "postgres:11-alpine"
10+
image: 'postgres:11-alpine'
1211
ports:
13-
- "5432:5432"
12+
- '5432:5432'
1413
environment:
1514
POSTGRES_PASSWORD: postgres
1615
POSTGRES_USER: postgres
1716

18-
1917
extractor:
20-
image: ghcr.io/bitfinity-network/evm-block-extractor:main
21-
# image: "evm-block-extractor:latest"
22-
# build:
23-
# dockerfile: ./src/evm-block-extractor/Dockerfile
18+
# image: ghcr.io/bitfinity-network/evm-block-extractor:main
19+
image: "evm-block-extractor:latest"
20+
build:
21+
dockerfile: ./src/evm-block-extractor/Dockerfile
2422
ports:
25-
- "8080:8080"
23+
- '8080:8080'
2624
command: --rpc-url https://testnet.bitfinity.network --postgres --username postgres --password postgres --database-name postgres --database-url db

src/evm-block-extractor/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::database::DatabaseClient;
1111

1212
const VERSION: &str = env!("CARGO_PKG_VERSION");
1313

14-
/// Simple CLI program for Benchmarking BitFinity Network
14+
/// Simple CLI parser for the EVM block extractor
1515
#[derive(Parser, Debug, Clone)]
1616
#[clap(
1717
version = VERSION,

0 commit comments

Comments
 (0)