Skip to content

Update README.md

Update README.md #8

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Authenticate to GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Configure Docker to use the Google Cloud Registry
run: gcloud auth configure-docker
- name: Build and push Docker image to GCR
run: |
docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/legalapp:latest .
docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/legalapp:latest
- name: Run FastAPI application and test Q&A
run: |
docker run -d -p 8000:8000 gcr.io/${{ secrets.GCP_PROJECT_ID }}/legalapp:latest # Start container
sleep 10 # Wait for the server to start
curl -X POST "http://localhost:8000/qa" -H "Content-Type: application/x-www-form-urlencoded" \
-d "question=What is the legal definition of negligence?&context=Negligence is the failure to take proper care in doing something."
docker stop $(docker ps -q) # Stop the running container
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Authenticate to GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Deploy to Cloud Run
run: |
gcloud run deploy legalapp \
--image gcr.io/${{ secrets.GCP_PROJECT_ID }}/legalapp:latest \
--platform managed \
--region ${{ secrets.GCP_REGION }} \
--allow-unauthenticated