Skip to content

Commit af059d6

Browse files
feat: add GitHub Actions workflow for Docker build and push (#95)
1 parent 578f751 commit af059d6

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
env:
9+
PROJECT_NAME: ai-media2doc
10+
11+
jobs:
12+
build-and-push:
13+
name: Build and Push Docker Images
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
module: [backend, frontend]
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: Login to Docker Hub
23+
uses: docker/login-action@v2
24+
with:
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_TOKEN }}
27+
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v2
33+
34+
- name: Build and push
35+
uses: docker/build-push-action@v4
36+
with:
37+
context: ./${{ matrix.module }}
38+
file: ./${{ matrix.module }}/Dockerfile
39+
platforms: linux/amd64,linux/arm64
40+
push: true
41+
tags: |
42+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.PROJECT_NAME }}-${{ matrix.module }}:${{ github.ref_name }}
43+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.PROJECT_NAME }}-${{ matrix.module }}:latest

0 commit comments

Comments
 (0)