-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (42 loc) · 1.34 KB
/
cicd.yaml
File metadata and controls
51 lines (42 loc) · 1.34 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
name: Deploy to Cloud Run
env:
SERVICE_NAME: custom-ocr-rag-app
PROJECT_ID: informationextraction-468103
DOCKER_IMAGE_URL: us-west1-docker.pkg.dev/informationextraction-468103/ocr-rag-app-repo/rag-api
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
dockerize-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Google Cloud Auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
project_id: ${{ env.PROJECT_ID }}
- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v2'
- name: Configure Docker
run: |
gcloud auth configure-docker us-west1-docker.pkg.dev
- name: Build and Push Docker image
run: |
docker build -t ${{ env.DOCKER_IMAGE_URL }}:latest -f Dockerfile .
docker push ${{ env.DOCKER_IMAGE_URL }}:latest
- name: Deploy to Cloud Run
run: |
echo SERVICE_NAME $SERVICE_NAME
gcloud run deploy $SERVICE_NAME \
--image ${{ env.DOCKER_IMAGE_URL }}:latest \
--platform managed \
--region us-west1 \
--allow-unauthenticated \
--memory 2Gi \
--timeout 900