Skip to content

Commit 96f51e7

Browse files
authored
Merge pull request #4 from ObolNetwork/oisin/dockerbuild
Push docker image building action
2 parents 63ebc52 + 1700784 commit 96f51e7

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/dockerimage.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build and Deploy Helios Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
build-docker:
14+
runs-on: ubuntu-latest
15+
name: Build Docker Image
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up QEMU
19+
id: qemu
20+
uses: docker/setup-qemu-action@v3
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
- name: Cache Docker layers
24+
uses: actions/cache@v4
25+
with:
26+
path: /tmp/.buildx-cache
27+
key: ${{ runner.os }}-buildx-${{ github.sha }}
28+
restore-keys: |
29+
${{ runner.os }}-buildx-
30+
31+
- name: Define docker image meta data tags
32+
id: meta
33+
uses: docker/metadata-action@v5
34+
with:
35+
images: |
36+
obolnetwork/helios
37+
ghcr.io/obolnetwork/helios
38+
tags: |
39+
type=sha,prefix=
40+
type=raw,value=latest
41+
42+
- name: Login to Github container registry
43+
uses: docker/login-action@v3
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Login to Dockerhub container registry
50+
uses: docker/login-action@v3
51+
with:
52+
username: obolnetwork
53+
password: ${{ secrets.DOCKERHUB_TOKEN }}
54+
55+
- uses: docker/build-push-action@v6
56+
with:
57+
context: .
58+
platforms: linux/amd64,linux/arm64
59+
push: true
60+
build-args: GITHUB_SHA=${{ github.sha }}
61+
tags: ${{ steps.meta.outputs.tags }}
62+
cache-from: type=local,src=/tmp/.buildx-cache
63+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
64+
65+
- name: Move cache
66+
run: |
67+
rm -rf /tmp/.buildx-cache
68+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

0 commit comments

Comments
 (0)