Skip to content

Commit 97a91a5

Browse files
Tamas Pallospallost
authored andcommitted
Add docker build workflow to CI
1 parent cb2a358 commit 97a91a5

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Push image to Docker hub and run e2e tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
push_to_registry:
12+
name: Build & Push docker image to Docker Hub
13+
runs-on: ubuntu-20.04
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Extract metadata to env variables
20+
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1
21+
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v2
24+
with:
25+
platforms: "arm64"
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v2
29+
30+
- name: Login to Docker Hub
31+
uses: docker/login-action@v2
32+
with:
33+
username: ${{ secrets.JORE4_DOCKERHUB_USER }}
34+
password: ${{ secrets.JORE4_DOCKERHUB_TOKEN }}
35+
36+
- name: Build and push dev builds to Docker Hub
37+
run: |
38+
docker buildx build \
39+
--push \
40+
--platform linux/amd64,linux/arm64 \
41+
--cache-from type=registry,ref=$IMAGE_NAME:builder \
42+
--cache-to type=registry,ref=$IMAGE_NAME:builder,mode=max \
43+
--tag $IMAGE_NAME:builder \
44+
.
45+
46+
docker buildx build \
47+
--push \
48+
--platform linux/amd64,linux/arm64 \
49+
--cache-from type=registry,ref=$IMAGE_NAME:builder \
50+
--tag $IMAGE_NAME:$COMMIT_ID \
51+
.
52+
53+
- name: Build and push :latest tag to Docker Hub
54+
if: ${{ github.ref == 'refs/heads/main' }}
55+
run: |
56+
docker buildx build \
57+
--push \
58+
--platform linux/amd64,linux/arm64 \
59+
--cache-from type=registry,ref=$IMAGE_NAME:builder \
60+
--tag $IMAGE_NAME:latest \
61+
.

0 commit comments

Comments
 (0)