-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (42 loc) · 1.36 KB
/
ml-model-container.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
50
51
52
name: Deploy ML Model
on:
push:
paths:
- "backend/**"
branches:
- master
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
IMAGE: prediction
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up GCP CLI
uses: google-github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GCP_FUNCTION_CI }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
export_default_credentials: true
- name: Setup Docker
run: |-
gcloud --quiet auth configure-docker
shell: bash
working-directory: ./backend
- name: Build Docker Image
run: |-
docker build \
--tag "gcr.io/$PROJECT_ID/$IMAGE" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
.
working-directory: ./backend
- name: Delete old image
run: gcloud container images delete gcr.io/$PROJECT_ID/$IMAGE:latest --quiet
- name: Publish Docker Image
run: |-
docker push "gcr.io/$PROJECT_ID/$IMAGE:latest"
- name: Deploy to Cloud Run
run: |-
gcloud run deploy $IMAGE --image="gcr.io/$PROJECT_ID/$IMAGE:latest" --max-instances=20 --memory=1Gi --allow-unauthenticated --platform=managed --region=us-central1