Skip to content

iamgabs/cloud-run-python-template

Repository files navigation

Cloud Run Python Template

This repository is a template for deploying a Python (FastAPI) application to Google Cloud Run using GitHub Actions.

Gabriel Carvalho

Overview

  • Framework: FastAPI
  • Deployment: Google Cloud Run
  • CI/CD: GitHub Actions (.github/workflows/cloud-run-deploy.yaml)

Required GitHub Secrets

To enable automatic deployment via GitHub Actions, you must set the following secrets in your repository:

Secret Name Description
GCP_PROJECT_ID Your Google Cloud Project ID
GCP_REGION The region where your Cloud Run service will be deployed
GCP_SA_EMAIL Service Account email with permissions to deploy to Cloud Run
SA_KEY JSON key for the Service Account (as a string)
ARTIFACT_REGISTRY_HOSTNAME Hostname of your Artifact Registry (e.g., us-central1-docker.pkg.dev)
ARTIFACT_REGISTRY_REPO Name of your Artifact Registry repository

You can set these secrets in your repository settings under Settings > Secrets and variables > Actions.

How to Use

  1. Clone this repository
  2. Set the required secrets as described above
  3. Push your code to the main branch
  4. The GitHub Actions workflow will automatically build and deploy your app to Cloud Run

Local Development

To run the FastAPI app locally:

pip install -r requirements.txt
python app/main.py

The app will be available at http://localhost:8000/.

License

MIT

About

A cloud run template for python web appications using FastAPI and UV

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published