This repository has been archived by the owner on Nov 15, 2024. It is now read-only.
Add deployment workflow 10 #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Google Cloud | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Authenticate with Google Cloud | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.GCP_SA_KEY }} | |
- name: Set up Google Cloud SDK | |
uses: google-github-actions/setup-gcloud@v2 | |
with: | |
project_id: c241-ps478 | |
- name: Download models | |
run: | | |
gsutil cp -r gs://waterwise/models/ models/ | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: false | |
tags: asia-east1-docker.pkg.dev/c241-ps478/waterwise/ml-service:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Push to Google Artifact Registry | |
run: | | |
gcloud auth configure-docker asia-east1-docker.pkg.dev | |
docker push asia-east1-docker.pkg.dev/c241-ps478/waterwise/ml-service:latest | |
- name: Deploy to Google Run | |
run: | | |
gcloud run deploy waterwise-ml \ | |
--image asia-east1-docker.pkg.dev/c241-ps478/waterwise/ml-service:latest \ | |
--platform managed \ | |
--region asia-east1 \ | |
--allow-unauthenticated \ | |
--port 5000 |