File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build and Push Docker Image
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ tags : ["v*"]
7+ pull_request :
8+ branches : ["main"]
9+
10+ env :
11+ REGISTRY : ghcr.io
12+ IMAGE_NAME : ${{ github.repository }}
13+
14+ jobs :
15+ build-and-push :
16+ runs-on : ubuntu-latest
17+ permissions :
18+ contents : read
19+ packages : write
20+
21+ steps :
22+ - name : Checkout repository
23+ uses : actions/checkout@v4
24+
25+ - name : Set up Docker Buildx
26+ uses : docker/setup-buildx-action@v3
27+
28+ - name : Log in to the Container Registry
29+ uses : docker/login-action@v3
30+ with :
31+ registry : ${{ env.REGISTRY }}
32+ username : ${{ github.actor }}
33+ password : ${{ secrets.GITHUB_TOKEN }}
34+
35+ - name : Extract metadata (tags, labels) for Docker
36+ id : meta
37+ uses : docker/metadata-action@v5
38+ with :
39+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
41+ - name : Build and push Docker image
42+ uses : docker/build-push-action@v5
43+ with :
44+ context : .
45+ push : true
46+ tags : ${{ steps.meta.outputs.tags }}
47+ labels : ${{ steps.meta.outputs.labels }}
48+ # Build for linux/amd64 and linux/arm64
49+ platforms : linux/amd64,linux/arm64
You can’t perform that action at this time.
0 commit comments