File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed
Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Publish Docker Image
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ env :
9+ REGISTRY : ghcr.io
10+ IMAGE_NAME : ${{ github.repository }}
11+
12+ jobs :
13+ build-and-push :
14+ runs-on : ubuntu-latest
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 GitHub Container Registry
24+ uses : docker/login-action@v3
25+ with :
26+ registry : ${{ env.REGISTRY }}
27+ username : ${{ github.actor }}
28+ password : ${{ secrets.GITHUB_TOKEN }}
29+
30+ - name : Extract metadata
31+ id : meta
32+ uses : docker/metadata-action@v5
33+ with :
34+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
35+ tags : |
36+ type=raw,value=latest,enable={{is_default_branch}}
37+ type=sha,prefix=sha-
38+
39+ - name : Set up Docker Buildx
40+ uses : docker/setup-buildx-action@v3
41+
42+ - name : Build and push Docker image
43+ uses : docker/build-push-action@v6
44+ with :
45+ context : .
46+ push : true
47+ tags : ${{ steps.meta.outputs.tags }}
48+ labels : ${{ steps.meta.outputs.labels }}
49+ cache-from : type=gha
50+ cache-to : type=gha,mode=max
Original file line number Diff line number Diff line change 11services :
22 app :
3- build : .
3+ image : ghcr.io/coscup/newsletter:latest
44 ports :
55 - " 8080:8080"
66 env_file : .env
You can’t perform that action at this time.
0 commit comments