Skip to content

Commit 2f478b6

Browse files
committed
ci: added build docker workflow
1 parent f3a77e9 commit 2f478b6

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/build-docker.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- Merge to Main Branch
7+
types:
8+
- completed
9+
10+
jobs:
11+
build-and-push-docker-image:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Setting Up QEMU
15+
uses: docker/setup-qemu-action@v2
16+
17+
- name: Setting Up Docker Buildx
18+
uses: docker/setup-buildx-action@v2
19+
20+
- name: Login to Docker Hub
21+
uses: docker/login-action@v2
22+
with:
23+
username: ${{ github.repository_owner }}
24+
password: ${{ secrets.DOCKERHUB_TOKEN }}
25+
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0 # Required for github-action-get-previous-tag
30+
31+
- name: Get Latest Tag
32+
id: get-tag
33+
uses: WyriHaximus/github-action-get-previous-tag@v1
34+
with:
35+
fallback: v1.0.0
36+
37+
- name: Building and Pushing
38+
uses: docker/build-push-action@v3
39+
if: steps.get-tag.outputs.tag
40+
with:
41+
push: true
42+
file: ./ci/Dockerfile
43+
tags: |
44+
${{ github.repository }}:${{ steps.get-tag.outputs.tag }}
45+
${{ github.repository }}:latest

0 commit comments

Comments
 (0)