Skip to content

Commit e01b752

Browse files
authored
Merge pull request #48 from junotb/feature/2026-02-12
feat: Cloud Run 배포 시 시크릿 기반 env vars 적용
2 parents 2d800c0 + 5fed473 commit e01b752

4 files changed

Lines changed: 47 additions & 10 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,47 @@ jobs:
6060
docker push ${IMAGE}:latest
6161
6262
- name: Deploy API to Cloud Run
63+
env:
64+
CLOUD_RUN_ENV_API: ${{ secrets.CLOUD_RUN_ENV_API }}
6365
run: |
6466
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
65-
gcloud run deploy lms-api \
66-
--image ${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.AR_REPO }}/lms-api:${SHORT_SHA} \
67-
--region ${{ env.GCP_REGION }} \
68-
--platform managed \
69-
--allow-unauthenticated
67+
if [ -n "$CLOUD_RUN_ENV_API" ]; then
68+
echo "$CLOUD_RUN_ENV_API" > /tmp/api-env.yaml
69+
gcloud run deploy lms-api \
70+
--image ${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.AR_REPO }}/lms-api:${SHORT_SHA} \
71+
--region ${{ env.GCP_REGION }} \
72+
--platform managed \
73+
--memory 512Mi \
74+
--timeout 300 \
75+
--allow-unauthenticated \
76+
--env-vars-file /tmp/api-env.yaml
77+
else
78+
gcloud run deploy lms-api \
79+
--image ${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.AR_REPO }}/lms-api:${SHORT_SHA} \
80+
--region ${{ env.GCP_REGION }} \
81+
--platform managed \
82+
--memory 512Mi \
83+
--timeout 300 \
84+
--allow-unauthenticated
85+
fi
7086
7187
- name: Deploy Web to Cloud Run
88+
env:
89+
CLOUD_RUN_ENV_WEB: ${{ secrets.CLOUD_RUN_ENV_WEB }}
7290
run: |
7391
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
74-
gcloud run deploy lms-web \
75-
--image ${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.AR_REPO }}/lms-web:${SHORT_SHA} \
76-
--region ${{ env.GCP_REGION }} \
77-
--platform managed \
78-
--allow-unauthenticated
92+
if [ -n "$CLOUD_RUN_ENV_WEB" ]; then
93+
echo "$CLOUD_RUN_ENV_WEB" > /tmp/web-env.yaml
94+
gcloud run deploy lms-web \
95+
--image ${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.AR_REPO }}/lms-web:${SHORT_SHA} \
96+
--region ${{ env.GCP_REGION }} \
97+
--platform managed \
98+
--allow-unauthenticated \
99+
--env-vars-file /tmp/web-env.yaml
100+
else
101+
gcloud run deploy lms-web \
102+
--image ${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.AR_REPO }}/lms-web:${SHORT_SHA} \
103+
--region ${{ env.GCP_REGION }} \
104+
--platform managed \
105+
--allow-unauthenticated
106+
fi

api/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ bin/
3939
.AppleDouble
4040
Thumbs.db
4141
ehthumbs.db
42+
43+
### Cloud Run ###
44+
cloud-run-env-api.yaml

api/src/main/resources/application.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
server:
2+
port: ${PORT:8080}
3+
14
spring:
25
application:
36
name: java-lms-api

web/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@ credentials/
4949
# typescript
5050
*.tsbuildinfo
5151
next-env.d.ts
52+
53+
# Cloud Run
54+
cloud-run-env-web.yaml

0 commit comments

Comments
 (0)