1- name : Docker Build and Push
1+ name : Docker Build Verification
22
33on :
44 push :
55 branches : [ main, master ]
6- tags : [ 'v*' ]
76 pull_request :
87 branches : [ main, master ]
98
9+ permissions :
10+ contents : read
11+
1012jobs :
1113 build :
1214 runs-on : ubuntu-latest
@@ -17,32 +19,17 @@ jobs:
1719 - name : Set up Docker Buildx
1820 uses : docker/setup-buildx-action@v2
1921
20- - name : Login to GitHub Container Registry
21- if : github.event_name != 'pull_request'
22- uses : docker/login-action@v2
23- with :
24- registry : ghcr.io
25- username : ${{ github.repository_owner }}
26- password : ${{ secrets.GITHUB_TOKEN }}
27-
28- - name : Extract metadata for Docker
29- id : meta
30- uses : docker/metadata-action@v4
31- with :
32- images : ghcr.io/${{ github.repository }}
33- tags : |
34- type=ref,event=branch
35- type=ref,event=pr
36- type=semver,pattern={{version}}
37- type=semver,pattern={{major}}.{{minor}}
38- type=sha,format=long
39-
40- - name : Build and push
22+ - name : Build Docker image
4123 uses : docker/build-push-action@v4
4224 with :
4325 context : .
44- push : ${{ github.event_name != 'pull_request' }}
45- tags : ${{ steps.meta.outputs.tags }}
46- labels : ${{ steps.meta.outputs.labels }}
26+ push : false
27+ load : true
28+ tags : test-build:latest
4729 cache-from : type=gha
48- cache-to : type=gha,mode=max
30+ cache-to : type=gha,mode=max
31+
32+ - name : Verify image
33+ run : |
34+ docker image ls
35+ echo "✅ Docker image built successfully"
0 commit comments