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 Docker image
2+ on :
3+ push :
4+ branches :
5+ - main
6+ workflow_dispatch :
7+
8+ jobs :
9+ build-and-push :
10+ runs-on : ubuntu-latest
11+ permissions :
12+ contents : read
13+ packages : write
14+ steps :
15+ - name : Get commit SHA
16+ id : commit
17+ run : |
18+ echo "sha=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
19+
20+ - name : Checkout
21+ uses : actions/checkout@v4
22+
23+ - name : Set up Docker Buildx
24+ uses : docker/setup-buildx-action@v3
25+
26+ - name : Log in to GitHub Container Registry
27+ uses : docker/login-action@v3
28+ with :
29+ registry : ghcr.io
30+ username : ${{ github.actor }}
31+ password : ${{ secrets.GITHUB_TOKEN }}
32+
33+ - name : Build and push Docker image
34+ uses : docker/build-push-action@v5
35+ with :
36+ context : .
37+ platforms : linux/amd64,linux/arm64
38+ push : true
39+ tags : |
40+ ghcr.io/${{ github.repository }}:${{ steps.commit.outputs.sha }}
41+ ghcr.io/${{ github.repository }}:latest
42+ cache-from : type=gha
43+ cache-to : type=gha,mode=max
You can’t perform that action at this time.
0 commit comments