-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
61 lines (55 loc) · 2.31 KB
/
Copy pathcloudbuild.yaml
File metadata and controls
61 lines (55 loc) · 2.31 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
steps:
# 1. Docker 이미지 빌드
- name: "gcr.io/cloud-builders/docker"
args:
- "build"
- "-t"
- "asia-northeast3-docker.pkg.dev/$PROJECT_ID/plan-b-repo/plan-b:$SHORT_SHA"
- "."
# 2. Artifact Registry에 푸시
- name: "gcr.io/cloud-builders/docker"
args:
- "push"
- "asia-northeast3-docker.pkg.dev/$PROJECT_ID/plan-b-repo/plan-b:$SHORT_SHA"
# 3. 마이그레이션 실행 (배포 전에 스키마 먼저 반영)
- name: "gcr.io/cloud-builders/docker"
id: Migrate
entrypoint: "bash"
args:
- "-c"
- |
docker run --rm \
-e DATABASE_URL=$$DATABASE_URL \
-e SECRET_KEY=$$SECRET_KEY \
asia-northeast3-docker.pkg.dev/$PROJECT_ID/plan-b-repo/plan-b:$SHORT_SHA \
python manage.py migrate
secretEnv: ["DATABASE_URL", "SECRET_KEY"]
# 4. Cloud Run 배포
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:slim"
entrypoint: gcloud
args:
- "run"
- "deploy"
- "planb"
- "--image=asia-northeast3-docker.pkg.dev/$PROJECT_ID/plan-b-repo/plan-b:$SHORT_SHA"
- "--region=asia-northeast3"
- "--platform=managed"
- "--allow-unauthenticated"
- "--min-instances=0"
- "--max-instances=3"
- "--memory=4Gi"
- "--cpu=2"
- "--timeout=300"
- "--concurrency=2"
- "--set-env-vars=^@^DEBUG=False@AI_MODEL_NAME=gemini-3.5-flash-lite@AI_MOCK_MODE=False@USE_GCS=True@GS_BUCKET_NAME=planb-media@SECURE_SSL_REDIRECT=True@ALLOWED_HOSTS=planb-729189969182.asia-northeast3.run.app,planb-study.site@CSRF_TRUSTED_ORIGINS=https://planb-729189969182.asia-northeast3.run.app,https://planb-study.site"
- "--set-secrets=SECRET_KEY=django-secret-key:latest,DATABASE_URL=database-url:latest,GOOGLE_API_KEY=google-api-key:latest,GOOGLE_CLIENT_ID=google-client-id:latest,GOOGLE_CLIENT_SECRET=google-client-secret:latest,NAVER_CLIENT_ID=naver-client-id:latest,NAVER_CLIENT_SECRET=naver-client-secret:latest"
availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/database-url/versions/latest
env: "DATABASE_URL"
- versionName: projects/$PROJECT_ID/secrets/django-secret-key/versions/latest
env: "SECRET_KEY"
images:
- "asia-northeast3-docker.pkg.dev/$PROJECT_ID/plan-b-repo/plan-b:$SHORT_SHA"
options:
logging: CLOUD_LOGGING_ONLY