-
Notifications
You must be signed in to change notification settings - Fork 0
297 lines (266 loc) · 11.2 KB
/
docker.yml
File metadata and controls
297 lines (266 loc) · 11.2 KB
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# Docker — 이미지 빌드 + 레지스트리 push + CVE 스캔
# 코드 품질 검증(lint/test)은 ci.yml에서 별도 실행
name: CI / Docker
on:
push:
branches: [develop, release]
workflow_dispatch:
inputs:
force:
description: "변경 감지를 무시하고 모든 서비스를 강제 실행"
required: false
default: false
type: boolean
permissions:
contents: read
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.sha }}
cancel-in-progress: false
jobs:
# ── 변경 감지 — 서비스별 선택적 빌드를 위한 matrix 생성 ──
detect:
runs-on: ubuntu-latest # github-hosted runner — dorny/paths-filter만 실행하는 경량 job
outputs:
services: ${{ steps.set-matrix.outputs.services }}
app: ${{ steps.flags.outputs.app }}
meetpie: ${{ steps.flags.outputs.meetpie }}
deskpie: ${{ steps.flags.outputs.deskpie }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
filters: .github/path-filters.yml
- id: set-matrix
env:
FORCE: ${{ inputs.force || github.event_name == 'workflow_dispatch' }}
WORKSPACE_ALL: ${{ steps.filter.outputs.workspace_all }}
BACKEND_INFRA: ${{ steps.filter.outputs.backend_infra }}
BACKEND_COMMON: ${{ steps.filter.outputs.backend_common }}
BACKEND_CRYPTO: ${{ steps.filter.outputs.backend_crypto }}
BACKEND_IAM: ${{ steps.filter.outputs.backend_iam }}
BACKEND_NOTIFICATION: ${{ steps.filter.outputs.backend_notification }}
BACKEND_AUDIT: ${{ steps.filter.outputs.backend_audit }}
BACKEND_AX: ${{ steps.filter.outputs.backend_ax }}
BACKEND_MCP: ${{ steps.filter.outputs.backend_mcp }}
BACKEND_APP: ${{ steps.filter.outputs.backend_app }}
BACKEND_MEETPIE: ${{ steps.filter.outputs.backend_meetpie }}
BACKEND_DESKPIE: ${{ steps.filter.outputs.backend_deskpie }}
BACKEND_DIST_APP: ${{ steps.filter.outputs.backend_dist_app }}
BACKEND_DIST_MEETPIE: ${{ steps.filter.outputs.backend_dist_meetpie }}
BACKEND_DIST_DESKPIE: ${{ steps.filter.outputs.backend_dist_deskpie }}
FRONTEND_APP: ${{ steps.filter.outputs.frontend_app }}
FRONTEND_APP_SHARED: ${{ steps.filter.outputs.frontend_app_shared }}
FRONTEND_MEETPIE: ${{ steps.filter.outputs.frontend_meetpie }}
FRONTEND_DESKPIE: ${{ steps.filter.outputs.frontend_deskpie }}
FRONTEND_TESTS_HELPERS: ${{ steps.filter.outputs.frontend_tests_helpers }}
FRONTEND_TESTS_BOOKING: ${{ steps.filter.outputs.frontend_tests_booking }}
BACKEND_ONLY: ${{ steps.filter.outputs.backend_only }}
run: bash scripts/ci-detect-services >> "$GITHUB_OUTPUT"
- id: flags
run: |
SERVICES='${{ steps.set-matrix.outputs.services }}'
echo "app=$(echo "$SERVICES" | jq 'contains(["app"])')" >> "$GITHUB_OUTPUT"
echo "meetpie=$(echo "$SERVICES" | jq 'contains(["meetpie"])')" >> "$GITHUB_OUTPUT"
echo "deskpie=$(echo "$SERVICES" | jq 'contains(["deskpie"])')" >> "$GITHUB_OUTPUT"
# ── 서비스별 이미지 빌드 + 조건부 push ──
build-app:
needs: detect
if: needs.detect.outputs.app == 'true'
runs-on: ["os:ubuntu", "arch:arm64", "purpose:build"]
steps:
- uses: actions/checkout@v6
- name: Login to Harbor
uses: docker/login-action@v3
with:
registry: ireg.querypie.io
username: ${{ vars.IREG_QUERYPIE_IO_USERNAME }}
password: ${{ secrets.IREG_QUERYPIE_IO_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Compute service SHA
id: sha
env:
GH_TOKEN: ${{ github.token }}
run: echo "sha=$(./scripts/image-sha app)" >> "$GITHUB_OUTPUT"
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ireg.querypie.io/ci/deck-app
tags: |
type=raw,value=dev-${{ steps.sha.outputs.sha }},enable=${{ github.ref == 'refs/heads/develop' }}
type=raw,value=dev-latest,enable=${{ github.ref == 'refs/heads/develop' }}
type=raw,value=${{ steps.sha.outputs.sha }},enable=${{ github.ref == 'refs/heads/release' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/release' }}
type=raw,value=manual-${{ steps.sha.outputs.sha }},enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: SERVICE=app
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=gha,scope=app-${{ github.ref_name }}
type=registry,ref=ireg.querypie.io/ci/deck-app:buildcache
cache-to: |
type=gha,scope=app-${{ github.ref_name }},mode=max
${{ github.event_name == 'push' && 'type=registry,ref=ireg.querypie.io/ci/deck-app:buildcache,mode=max' || '' }}
env:
BUILDKIT_PROGRESS: plain
build-meetpie:
needs: detect
if: needs.detect.outputs.meetpie == 'true'
runs-on: ["os:ubuntu", "arch:arm64", "purpose:build"]
steps:
- uses: actions/checkout@v6
- name: Login to Harbor
uses: docker/login-action@v3
with:
registry: ireg.querypie.io
username: ${{ vars.IREG_QUERYPIE_IO_USERNAME }}
password: ${{ secrets.IREG_QUERYPIE_IO_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Compute service SHA
id: sha
env:
GH_TOKEN: ${{ github.token }}
run: echo "sha=$(./scripts/image-sha meetpie)" >> "$GITHUB_OUTPUT"
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ireg.querypie.io/ci/deck-meetpie
tags: |
type=raw,value=dev-${{ steps.sha.outputs.sha }},enable=${{ github.ref == 'refs/heads/develop' }}
type=raw,value=dev-latest,enable=${{ github.ref == 'refs/heads/develop' }}
type=raw,value=${{ steps.sha.outputs.sha }},enable=${{ github.ref == 'refs/heads/release' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/release' }}
type=raw,value=manual-${{ steps.sha.outputs.sha }},enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: SERVICE=meetpie
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=gha,scope=meetpie-${{ github.ref_name }}
type=registry,ref=ireg.querypie.io/ci/deck-app:buildcache
type=registry,ref=ireg.querypie.io/ci/deck-meetpie:buildcache
cache-to: |
type=gha,scope=meetpie-${{ github.ref_name }},mode=max
${{ github.event_name == 'push' && 'type=registry,ref=ireg.querypie.io/ci/deck-meetpie:buildcache,mode=max' || '' }}
env:
BUILDKIT_PROGRESS: plain
build-deskpie:
needs: detect
if: needs.detect.outputs.deskpie == 'true'
runs-on: ["os:ubuntu", "arch:arm64", "purpose:build"]
steps:
- uses: actions/checkout@v6
- name: Login to Harbor
uses: docker/login-action@v3
with:
registry: ireg.querypie.io
username: ${{ vars.IREG_QUERYPIE_IO_USERNAME }}
password: ${{ secrets.IREG_QUERYPIE_IO_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Compute service SHA
id: sha
env:
GH_TOKEN: ${{ github.token }}
run: echo "sha=$(./scripts/image-sha deskpie)" >> "$GITHUB_OUTPUT"
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ireg.querypie.io/ci/deck-deskpie
tags: |
type=raw,value=dev-${{ steps.sha.outputs.sha }},enable=${{ github.ref == 'refs/heads/develop' }}
type=raw,value=dev-latest,enable=${{ github.ref == 'refs/heads/develop' }}
type=raw,value=${{ steps.sha.outputs.sha }},enable=${{ github.ref == 'refs/heads/release' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/release' }}
type=raw,value=manual-${{ steps.sha.outputs.sha }},enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: SERVICE=deskpie
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=gha,scope=deskpie-${{ github.ref_name }}
type=registry,ref=ireg.querypie.io/ci/deck-app:buildcache
type=registry,ref=ireg.querypie.io/ci/deck-deskpie:buildcache
cache-to: |
type=gha,scope=deskpie-${{ github.ref_name }},mode=max
${{ github.event_name == 'push' && 'type=registry,ref=ireg.querypie.io/ci/deck-deskpie:buildcache,mode=max' || '' }}
env:
BUILDKIT_PROGRESS: plain
# ── CVE 스캔 — push 이벤트에서만, 빌드와 병렬 실행, 배포를 blocking하지 않음 ──
scan-app:
if: github.event_name == 'push' && needs.detect.outputs.app == 'true'
needs: [detect, build-app]
uses: ./.github/workflows/scan.yml
with:
service: app
secrets: inherit
scan-meetpie:
if: github.event_name == 'push' && needs.detect.outputs.meetpie == 'true'
needs: [detect, build-meetpie]
uses: ./.github/workflows/scan.yml
with:
service: meetpie
secrets: inherit
scan-deskpie:
if: github.event_name == 'push' && needs.detect.outputs.deskpie == 'true'
needs: [detect, build-deskpie]
uses: ./.github/workflows/scan.yml
with:
service: deskpie
secrets: inherit
# ── Dev 자동 배포 — 빌드 성공 후 서비스별 독립 트리거 ──
deploy-dev-app:
needs: [detect, build-app]
if: |
github.ref == 'refs/heads/develop' &&
github.event_name == 'push' &&
needs.detect.outputs.app == 'true'
uses: ./.github/workflows/deploy-dev.yml
with:
service: app
db_reset: true
secrets: inherit
deploy-dev-meetpie:
needs: [detect, build-meetpie]
if: |
github.ref == 'refs/heads/develop' &&
github.event_name == 'push' &&
needs.detect.outputs.meetpie == 'true'
uses: ./.github/workflows/deploy-dev.yml
with:
service: meetpie
db_reset: true
secrets: inherit
deploy-dev-deskpie:
needs: [detect, build-deskpie]
if: |
github.ref == 'refs/heads/develop' &&
github.event_name == 'push' &&
needs.detect.outputs.deskpie == 'true'
uses: ./.github/workflows/deploy-dev.yml
with:
service: deskpie
db_reset: true
secrets: inherit