generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 0
205 lines (196 loc) · 6.5 KB
/
build-docker-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: Build Docker Images
on:
workflow_dispatch:
push:
branches:
- master
env:
USERS_IMAGE_NAME: peerprep-users-service
EXECUTOR_IMAGE_NAME: peerprep-executor-service
INNKEEPER_IMAGE_NAME: peerprep-innkeeper-service
QUESTIONS_IMAGE_NAME: peerprep-questions-service
FRONTEND_IMAGE_NAME: peerprep-frontend
NGINX_IMAGE_NAME: peerprep-nginx
jobs:
changes:
runs-on: ubuntu-latest
outputs:
users: ${{ steps.changes.outputs.users }}
executor: ${{ steps.changes.outputs.executor }}
innkeeper: ${{ steps.changes.outputs.innkeeper }}
questions: ${{ steps.changes.outputs.questions }}
frontend: ${{ steps.changes.outputs.frontend }}
nginx: ${{ steps.changes.outputs.nginx }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
users:
- 'users/**/*'
executor:
- 'executor/**/*'
innkeeper:
- 'innkeeper/**/*'
questions:
- 'questions/**/*'
frontend:
- 'frontend/**/*'
nginx:
- 'deployment/**/*'
build-users-image:
needs: changes
if: ${{ needs.changes.outputs.users == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out Source
uses: actions/checkout@v2
- name: Log in to the Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: peerprep
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: deployment/Dockerfile-users
push: true
tags: ghcr.io/peerprep/${{ env.USERS_IMAGE_NAME }}:latest
build-executor-image:
needs: changes
if: ${{ needs.changes.outputs.executor == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out Source
uses: actions/checkout@v2
with:
submodules: recursive
- name: Log in to the Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: peerprep
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: deployment/Dockerfile-executor
push: true
tags: ghcr.io/peerprep/${{ env.EXECUTOR_IMAGE_NAME }}:latest
build-innkeeper-image:
needs: changes
if: ${{ needs.changes.outputs.innkeeper == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out Source
uses: actions/checkout@v2
- name: Log in to the Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: peerprep
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: deployment/Dockerfile-innkeeper
push: true
tags: ghcr.io/peerprep/${{ env.INNKEEPER_IMAGE_NAME }}:latest
build-questions-image:
needs: changes
if: ${{ needs.changes.outputs.questions == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out Source
uses: actions/checkout@v2
- name: Log in to the Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: peerprep
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: deployment/Dockerfile-questions
push: true
tags: ghcr.io/peerprep/${{ env.QUESTIONS_IMAGE_NAME }}:latest
build-frontend-image:
needs: changes
if: ${{ needs.changes.outputs.frontend == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out Source
uses: actions/checkout@v2
- name: Make Environment File
uses: SpicyPizza/create-envfile@v1.3
with:
envkey_NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
envkey_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
envkey_NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
envkey_NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}
envkey_NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}
envkey_NEXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}
envkey_NEXT_PUBLIC_GOOGLE_CLIENT_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_CLIENT_ID }}
envkey_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
envkey_NEXT_PUBLIC_PEERPREP_INNKEEPER_SOCKET_URL: ${{ secrets.NEXT_PUBLIC_PEERPREP_INNKEEPER_SOCKET_URL }}
directory: frontend
file_name: .env
fail_on_empty: true
- name: Log in to the Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: peerprep
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: deployment/Dockerfile-frontend
push: true
tags: ghcr.io/peerprep/${{ env.FRONTEND_IMAGE_NAME }}:latest
build-nginx-image:
needs: changes
if: ${{ needs.changes.outputs.nginx == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out Source
uses: actions/checkout@v2
- name: Log in to the Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: peerprep
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: deployment/Dockerfile-nginx
push: true
tags: ghcr.io/peerprep/${{ env.NGINX_IMAGE_NAME }}:latest