Sample code to deploy Streamlit dashboard app with Google Cloud Run
You can deploy Streamlit dashboard app with only two commands. This sample dashboard visualizes greenhouse gas open data. Data sources are written below.
- Clone this repository in Google Cloud Shell
$ git clone https://github.com/Olivine-Ryo/streamlit-cloudrun-sample.git
- Deploy with Buildpacks (if asked "Allow unauthenticated invocations to [greenhousegas-dashboard] (y/N)?", return yes.)
$ cd ./streamlit-cloudrun-sample
$ gcloud run deploy greenhousegas-dashboard --source . --timeout=3600
Then you can see your dashboard link in the terminal.
Deployment by Buildpacks occasionally fails because its build time takes more than 10 minutes. Then you can deploy to other regions or deploy with Dockerfile as below.
$ gcloud builds submit --tag asia.gcr.io/${PROJECT-ID}/greenhousegas-dashboard:v
$ gcloud run deploy greenhousegas-dashboard --image asia.gcr.io/${PROJECT-ID}/greenhousegas-dashboard:v1
This dashboard is the reproduction of CO2 Data Explorer in Our World in Data under the Creative Commons BY license. The data sources are as below. All of them are under the Creative Commons BY license.