Skip to content

Commit 4fe02c5

Browse files
committed
added action
1 parent 2c2425d commit 4fe02c5

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/cicd.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy to Cloud Run
2+
3+
env:
4+
SERVICE_NAME: custom-ocr-rag-app
5+
PROJECT_ID: informationextraction-468103
6+
DOCKER_IMAGE_URL: us-west1-docker.pkg.dev/informationextraction-468103/ocr-rag-app-repo/rag-api:latest
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
pull_request:
13+
branches:
14+
- main
15+
16+
jobs:
17+
dockerize-and-deploy:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v2
23+
24+
- name: Google Cloud Auth
25+
uses: 'google-github-actions/auth@v2'
26+
with:
27+
credentials_json: '${{ secrets.GCP_SA_KEY }}'
28+
project_id: ${{ env.PROJECT_ID }}
29+
30+
- name: Set up Cloud SDK
31+
uses: 'google-github-actions/setup-gcloud@v2'
32+
33+
- name: Configure Docker
34+
run: |
35+
gcloud auth configure-docker us-west1-docker.pkg.dev
36+
37+
- name: Build and Push Docker image
38+
run: |
39+
docker build -t ${{ env.DOCKER_IMAGE_URL }}:latest -f Dockerfile.prod .
40+
docker push ${{ env.DOCKER_IMAGE_URL }}:latest
41+
42+
- name: Deploy to Cloud Run
43+
run: |
44+
echo SERVICE_NAME $SERVICE_NAME
45+
gcloud run deploy $SERVICE_NAME \
46+
--image ${{ env.DOCKER_IMAGE_URL }}:latest \
47+
--platform managed \
48+
--region us-west1 \
49+
--allow-unauthenticated

0 commit comments

Comments
 (0)