-
Notifications
You must be signed in to change notification settings - Fork 44
49 lines (41 loc) · 1.45 KB
/
cloud-run.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
name: Build and Deploy to cloud Run
on:
push:
branches:
- master
env:
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
RUN_REGION: us-central1
SERVICE_NAME: algo-book
jobs:
build:
name: Cloud Run Deployment
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup GCP Service Account
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: "latest"
service_account_email: ${{ secrets.SA_EMAIL }}
service_account_key: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS}}
export_default_credentials: true
- name: Configure Docker
run: |
gcloud auth configure-docker
- name: Build
run: |
docker build -f ./docker/production/Dockerfile -t gcr.io/$PROJECT_ID/$SERVICE_NAME:latest .
- name: Push
run: |
docker push gcr.io/$PROJECT_ID/$SERVICE_NAME:latest
- name: Deploy
run: |
gcloud run deploy $SERVICE_NAME \
--region $RUN_REGION \
--image gcr.io/$PROJECT_ID/$SERVICE_NAME \
--platform managed \
--allow-unauthenticated \
--project $PROJECT_ID \
--port=3000