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 : Docker Build and Publish
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ jobs :
8+ build-and-push :
9+ runs-on : ubuntu-latest
10+ permissions :
11+ contents : read
12+ packages : write
13+
14+ steps :
15+ - uses : actions/checkout@v4
16+
17+ - name : Get app name from package.json
18+ id : package
19+ run : |
20+ APP_NAME=$(node -p "require('./package.json').name")
21+ echo "APP_NAME=$APP_NAME" >> $GITHUB_ENV
22+
23+ - name : Set up Docker Buildx
24+ uses : docker/setup-buildx-action@v3
25+
26+ - name : Login 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 Local Image
34+ uses : docker/build-push-action@v5
35+ with :
36+ context : .
37+ push : true
38+ tags : ghcr.io/${{ github.repository }}/${{ env.APP_NAME }}:local
39+ build-args : |
40+ VITE_API_URL=http://localhost:8000
41+ cache-from : type=gha
42+ cache-to : type=gha,mode=max
43+
44+ - name : Build and Push Production Image
45+ uses : docker/build-push-action@v5
46+ with :
47+ context : .
48+ push : true
49+ tags : ghcr.io/${{ github.repository }}/${{ env.APP_NAME }}:prod
50+ build-args : |
51+ VITE_API_URL=https://w2025-demo.deployed.space/api
52+ cache-from : type=gha
53+ cache-to : type=gha,mode=max
You can’t perform that action at this time.
0 commit comments