1+ name : " Build & Push Docker"
2+
3+ on :
4+ push :
5+ branches :
6+ - tf/docker-ci-test # Testing
7+ - next # Next, tags as "next"
8+ - master # Edge, tags as "edge"
9+ - release # Production, tags as "latest"
10+
11+ concurrency :
12+ group : ${{ github.workflow }}-${{ github.ref_name }}
13+ cancel-in-progress : true
14+
15+ env :
16+ REGISTRY : ghcr.io
17+ IMAGE_NAME : ${{ github.repository }}
18+ MANAGED_REGISTRY : registry.digitalocean.com/manifold
19+
20+ jobs :
21+ build-api :
22+ runs-on : ubuntu-latest
23+ permissions :
24+ contents : read
25+ packages : write
26+ steps :
27+ - name : Checkout
28+ uses : actions/checkout@v4
29+ - name : Login GHCR
30+ uses : docker/login-action@v4
31+ with :
32+ registry : ghcr.io
33+ username : ${{ github.actor }}
34+ password : ${{ secrets.GITHUB_TOKEN }}
35+ - name : Login DOCR
36+ uses : docker/login-action@v4
37+ with :
38+ registry : registry.digitalocean.com/manifold
39+ username : docr
40+ password : ${{ secrets.DOCR_TOKEN }}
41+ - name : Docker meta
42+ id : meta
43+ uses : docker/metadata-action@v5
44+ with :
45+ images : |
46+ ghcr.io/ManifoldScholar/manifold-api
47+ registry.digitalocean.com/manifold/manifold-api
48+ tags : |
49+ type=raw,value=latest,enable=${{ github.ref_name == 'release' }}
50+ type=raw,value=edge,enable={{ is_default_branch }}
51+ type=ref,event=branch
52+ type=sha
53+ - name : Set up Docker Buildx
54+ uses : docker/setup-buildx-action@v3
55+ - name : Build and push Docker
56+ id : push
57+ uses : docker/build-push-action@v5
58+ with :
59+ context : ./api
60+ target : production
61+ push : true
62+ cache-from : type=gha
63+ cache-to : type=gha,mode=max
64+ tags : ${{ steps.meta.outputs.tags }}
65+ labels : ${{ steps.meta.outputs.labels }}
66+ build-args :
67+ " RAILS_ENV=production"
68+
69+ build-client :
70+ runs-on : ubuntu-latest
71+ permissions :
72+ contents : read
73+ packages : write
74+ steps :
75+ - name : Checkout
76+ uses : actions/checkout@v4
77+ - name : Login GHCR
78+ uses : docker/login-action@v4
79+ with :
80+ registry : ${{ env.REGISTRY }}
81+ username : ${{ github.actor }}
82+ password : ${{ secrets.GITHUB_TOKEN }}
83+ - name : Login DOCR
84+ uses : docker/login-action@v4
85+ with :
86+ registry : ${{ env.MANAGED_REGISTRY }}
87+ username : docr
88+ password : ${{ secrets.DOCR_TOKEN }}
89+ - name : Docker meta
90+ id : meta
91+ uses : docker/metadata-action@v5
92+ with :
93+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-client
94+ tags : |
95+ type=raw,value=latest,enable=${{ github.ref_name == 'release' }}
96+ type=raw,value=edge,enable={{ is_default_branch }}
97+ type=ref,event=branch
98+ type=sha
99+ - name : Set up Docker Buildx
100+ uses : docker/setup-buildx-action@v3
101+ - name : Build and push Docker
102+ id : push
103+ uses : docker/build-push-action@v5
104+ with :
105+ context : ./client
106+ target : production
107+ push : true
108+ cache-from : type=gha
109+ cache-to : type=gha,mode=max
110+ tags : ${{ steps.meta.outputs.tags }}
111+ labels : ${{ steps.meta.outputs.labels }}
112+ build-args :
113+ " RAILS_ENV=production"
0 commit comments