Skip to content

Commit abc8011

Browse files
authored
feat: publish docker image of l1-chain (#146)
1 parent be8b4ee commit abc8011

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed
+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: 'Build & Plush Docker'
2+
3+
inputs:
4+
compose-version:
5+
description: 'Docker Compose version'
6+
default: 2.6.0
7+
registry:
8+
description: 'Docker registry service'
9+
default: ghcr.io
10+
username:
11+
description: 'Username for https://ghcr.io'
12+
required: true
13+
password:
14+
description: 'Password for https://ghcr.io'
15+
required: true
16+
image:
17+
description: 'Image name with provider url'
18+
required: true
19+
dockerfile:
20+
description: 'Path to the Dockerfile'
21+
required: true
22+
context:
23+
description: 'Path to the Context'
24+
default: .
25+
required: true
26+
build-args:
27+
description: 'List of build-time variables'
28+
required: false
29+
30+
outputs:
31+
image:
32+
description: 'Image url'
33+
value: ${{ steps.imageOuput.outputs.imageUrl }}
34+
imageid:
35+
description: 'Image ID'
36+
value: ${{ steps.publish.outputs.imageId }}
37+
digest:
38+
description: 'Image digest'
39+
value: ${{ steps.publish.outputs.digest }}
40+
metadata:
41+
description: 'Build result metadata'
42+
value: ${{ steps.publish.outputs.metadata }}
43+
44+
runs:
45+
using: 'composite'
46+
steps:
47+
- name: Log in to the ghcr.io registry
48+
uses: docker/login-action@v2
49+
with:
50+
registry: ${{ inputs.registry }}
51+
username: ${{ inputs.username }}
52+
password: ${{ inputs.password }}
53+
54+
- name: Docker meta
55+
id: meta
56+
uses: docker/metadata-action@v3
57+
with:
58+
images: |
59+
${{ inputs.image }}
60+
tags: |
61+
type=ref,event=branch
62+
type=sha,prefix=
63+
type=semver,pattern={{raw}}
64+
65+
- name: Set up Docker Buildx
66+
uses: docker/setup-buildx-action@v1
67+
68+
- name: Build and push the image to ghcr.io
69+
uses: docker/build-push-action@v4
70+
id: publish
71+
with:
72+
context: ${{ inputs.context }}
73+
file: ${{ inputs.dockerfile }}
74+
push: true
75+
tags: ${{ steps.meta.outputs.tags }}
76+
labels: ${{ steps.meta.outputs.labels }}
77+
build-args: ${{ inputs.build-args }}
78+
cache-from: type=gha
79+
cache-to: type=gha,mode=max
80+
- id: imageOuput
81+
shell: bash
82+
run: |
83+
echo "imageUrl=${{ fromJSON(steps.publish.outputs.metadata)['image.name'] }}" >> $GITHUB_OUTPUT

.github/workflows/docker-publish.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build ad publish Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize]
9+
release:
10+
types: [published]
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build-and-publish-image:
18+
runs-on: buildjet-4vcpu-ubuntu-2204
19+
if: |
20+
(github.event_name == 'release' && github.event.action == 'published') ||
21+
github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: Build and push Fuel Bridge Ethereum Test Image
26+
uses: ./.github/actions/docker-publish
27+
id: publish
28+
with:
29+
username: ${{ github.repository_owner }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
image: ghcr.io/fuellabs/fuel-bridge
32+
dockerfile: docker/l1-chain/Dockerfile

0 commit comments

Comments
 (0)