-
Notifications
You must be signed in to change notification settings - Fork 2
113 lines (94 loc) · 3.56 KB
/
deploy.yaml
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
name: Deploy to Cloud Run
on:
push:
tags:
- 'v*'
jobs:
api_deploy:
name: Deploy API
runs-on: ubuntu-latest
env:
SENTRY_DSN: ${{ secrets.WHISPER_API_SENTRY_DSN }}
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/whisper-api
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Login to Google
uses: google-github-actions/auth@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account: ${{ secrets.GCP_EMAIL }}
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Get Version Tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Get Git Revision
run: echo "GIT_REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build Docker Image
run: |
docker build \
-f containers/api/Dockerfile \
--build-arg GIT_REVISION=$GIT_REVISION \
--build-arg SENTRY_DSN=$SENTRY_DSN \
-t $IMAGE_NAME:$RELEASE_VERSION .
- name: Push Docker Image
run: docker push $IMAGE_NAME:$RELEASE_VERSION
- name: Deploy Docker Image
run: |
gcloud run deploy whisper-api \
--image $IMAGE_NAME:$RELEASE_VERSION \
--region us-east1 --platform managed \
--cpu 1 --memory 512Mi --port 8318 \
--max-instances 16 --concurrency 48 \
--allow-unauthenticated
web_deploy:
name: Deploy Web UI
runs-on: ubuntu-latest
env:
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/whisper-ui
SENTRY_DSN: ${{ secrets.WHISPER_WEB_SENTRY_DSN }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Login to Google
uses: google-github-actions/auth@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account: ${{ secrets.GCP_EMAIL }}
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Get Version Tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Get Git Revision
run: echo "GIT_REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build Docker Image
run: |
docker build \
-f containers/web/Dockerfile \
--build-arg REACT_APP_API_BASE_URL=https://api.whisper.rotational.dev/v1 \
--build-arg REACT_APP_UI_BASE_URL=https://whisper.rotational.dev \
--build-arg REACT_APP_GIT_REVISION=$GIT_REVISION \
--build-arg REACT_APP_SENTRY_DSN=$SENTRY_DSN \
--build-arg REACT_APP_RELEASE_VERSION=$RELEASE_VERSION \
--build-arg NODE_ENV=production \
-t $IMAGE_NAME:$RELEASE_VERSION .
- name: Push Docker Image
run: docker push $IMAGE_NAME:$RELEASE_VERSION
- name: Deploy Docker Image
run: |
gcloud run deploy whisper-ui \
--image $IMAGE_NAME:$RELEASE_VERSION \
--region us-east1 --platform managed \
--cpu 1 --memory 512Mi \
--max-instances 16 --concurrency 48 \
--allow-unauthenticated