Skip to content

Commit d08bd8c

Browse files
authored
docker build and publish
1 parent 90b7eca commit d08bd8c

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
release:
7+
types: [ published ]
8+
9+
jobs:
10+
build-and-push:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Log in to GitHub Container Registry
21+
uses: docker/login-action@v3
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Extract metadata for Docker
28+
id: meta
29+
uses: docker/metadata-action@v5
30+
with:
31+
images: ghcr.io/${{ github.repository }}
32+
33+
- name: Build and push Docker image
34+
uses: docker/build-push-action@v5
35+
with:
36+
context: .
37+
push: true
38+
tags: |
39+
ghcr.io/${{ github.repository }}:latest
40+
ghcr.io/${{ github.repository }}:${{ github.sha }}
41+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)