cxumol commited on
Commit
e422669
·
unverified ·
1 Parent(s): 26b50b8

Create docker-build-push.yml

Browse files
.github/workflows/docker-build-push.yml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build and Push Docker Image
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ build-and-push:
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: read
16
+ packages: write
17
+
18
+ steps:
19
+ - name: Checkout repository
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Set up Docker Buildx
23
+ uses: docker/setup-buildx-action@v3
24
+
25
+ - name: Login to GitHub Container Registry
26
+ uses: docker/login-action@v3
27
+ with:
28
+ registry: ghcr.io
29
+ username: ${{ github.actor }}
30
+ password: ${{ secrets.GITHUB_TOKEN }}
31
+
32
+ - name: Build and push Docker image
33
+ uses: docker/build-push-action@v5
34
+ with:
35
+ context: .
36
+ push: true
37
+ tags: |
38
+ ghcr.io/${{ github.repository }}:latest
39
+ ghcr.io/${{ github.repository }}:${{ github.sha }}
40
+ cache-from: type=gha
41
+ cache-to: type=gha,mode=max