Skip to content

Commit 0bc5fe9

Browse files
committed
move to ghcr registry
Signed-off-by: Aditya Joshi <[email protected]>
1 parent 4b46082 commit 0bc5fe9

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

.github/workflows/release.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Copyright the Hyperledger Blockchain Explorer contributors. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Build docker image
6+
7+
on:
8+
workflow_dispatch: # workflow_dispatch must be enabled in main branch to support release action on older release branches
9+
create:
10+
tags:
11+
- v*
12+
push:
13+
branches:
14+
- main
15+
paths:
16+
- "Dockerfile"
17+
- "postgres-Dockerfile"
18+
19+
env:
20+
REGISTRY: ghcr.io
21+
22+
permissions:
23+
contents: read
24+
packages: write
25+
26+
jobs:
27+
# on tag vx.y.z created, create docker tag x.y.z
28+
build-and-push-docker-release:
29+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
30+
runs-on: ubuntu-latest
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
- dockerfile: ./Dockerfile
36+
component: explorer
37+
- dockerfile: ./postgres-Dockerfile
38+
component: explorer-db
39+
permissions:
40+
contents: read
41+
packages: write
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v3
45+
46+
- name: Set up QEMU
47+
uses: docker/setup-qemu-action@v2
48+
49+
- name: Set up Docker Buildx
50+
uses: docker/setup-buildx-action@v2
51+
with:
52+
buildkitd-flags: --debug
53+
config-inline: |
54+
[worker.oci]
55+
max-parallelism = 1
56+
- name: Docker meta
57+
id: meta
58+
uses: docker/metadata-action@v4
59+
with:
60+
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.component }}
61+
tags: |
62+
type=semver,pattern={{version}}
63+
type=semver,pattern={{major}}.{{minor}}
64+
type=semver,pattern={{major}}.{{minor}}.{{patch}}
65+
66+
- name: Login to the container registry
67+
uses: docker/login-action@v2
68+
with:
69+
registry: ${{ env.REGISTRY }}
70+
username: ${{ github.actor }}
71+
password: ${{ secrets.GITHUB_TOKEN }}
72+
73+
- name: Build and push ${{ matrix.component }} Image
74+
id: push
75+
uses: docker/build-push-action@v4
76+
with:
77+
context: .
78+
file: ${{ matrix.dockerfile }}
79+
push: true
80+
platforms: linux/amd64,linux/arm64
81+
tags: ${{ steps.meta.outputs.tags }}

0 commit comments

Comments
 (0)