File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Docker image build
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - origin/feature/github-actions-docker-build
8+ tags :
9+ - v*
10+
11+ jobs :
12+ build-and-push-image :
13+ runs-on : ubuntu-latest
14+
15+ permissions :
16+ contents : read
17+ packages : write
18+
19+ steps :
20+ - name : Checkout repository
21+ uses : actions/checkout@v4
22+
23+ - name : Log in to the Container registry
24+ uses : docker/login-action@v3
25+ with :
26+ registry : ghcr.io
27+ username : ${{ github.repository_owner }}
28+ password : ${{ secrets.GITHUB_TOKEN }}
29+
30+ - name : Extract metadata (tags, labels) for Docker
31+ id : meta
32+ uses : docker/metadata-action@v5
33+ with :
34+ images : ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
35+ tags : |
36+ type=semver,pattern={{version}}
37+ type=semver,pattern={{major}}.{{minor}}
38+ type=semver,pattern={{major}}
39+ type=edge,branch=main
40+
41+ - name : Build and push Docker image
42+ uses : docker/build-push-action@v6
43+ with :
44+ context : .
45+ file : ./Dockerfile
46+ push : true
47+ tags : ${{ steps.meta.outputs.tags }}
48+ labels : ${{ steps.meta.outputs.labels }}
49+ target : prod
You can’t perform that action at this time.
0 commit comments