File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Docker Publish
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ push_to_registry :
7+ description : ' Push image to registry'
8+ required : false
9+ default : true
10+ type : boolean
11+
12+ env :
13+ REGISTRY : ghcr.io
14+ IMAGE_NAME : ${{ github.repository }}
15+
16+ jobs :
17+ build-and-push :
18+ name : Build and Push Docker Image
19+ runs-on : ubuntu-latest
20+ permissions :
21+ contents : read
22+ packages : write
23+
24+ steps :
25+ - name : Checkout code
26+ uses : actions/checkout@v4
27+
28+ - name : Set up Docker Buildx
29+ uses : docker/setup-buildx-action@v3
30+
31+ - name : Log in to GitHub Container Registry
32+ uses : docker/login-action@v3
33+ with :
34+ registry : ${{ env.REGISTRY }}
35+ username : ${{ github.actor }}
36+ password : ${{ secrets.GITHUB_TOKEN }}
37+
38+ - name : Build and push Docker image
39+ uses : docker/build-push-action@v5
40+ with :
41+ context : .
42+ file : ./Dockerfile
43+ push : ${{ inputs.push_to_registry }}
44+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
45+ cache-from : type=gha
46+ cache-to : type=gha,mode=max
You can’t perform that action at this time.
0 commit comments