Fix Dockerfile for fastapi #3
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: Build and Deploy a Container | |
env: | |
PROJECT_ID: ${{ secrets.GCP_PROJECT }} | |
SERVICE: ragtube | |
REGION: asia-south1 | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Cloud SDK | |
uses: google-github-actions/[email protected] | |
with: | |
project_id: ${{ env.PROJECT_ID }} | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
export_default_credentials: true # Set to true to authenticate the Cloud Run action | |
- name: Authorize Docker push | |
run: gcloud auth configure-docker | |
- name: Build and Push Container | |
run: |- | |
docker build -t gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} . | |
docker push gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} | |
- name: Deploy to Cloud Run | |
id: deploy | |
uses: google-github-actions/[email protected] | |
with: | |
service: ${{ env.SERVICE }} | |
image: gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} | |
region: ${{ env.REGION }} | |
- name: Show Output | |
run: echo ${{ steps.deploy.outputs.url }} |