Step 2: Create a Cloud Run service Stay organized with collections Save and categorize content based on your preferences.
In this step, you create a Cloud Run service to deploy the app from therepository that you forked in the previous step. You also set up an automaticCloud Build trigger, so that the app is built and deployed to Google Cloudwhenever you push a new commit to the repository.
Create a Cloud Run service with continuous build
In the Google Cloud console, navigate to Cloud Run.
ClickCreate service.
SelectContinuously deploy from a repository.
ClickSet up with Cloud Build.
In theRepository list, select the forked GitHub repository that you createdfor your app.
If your repository isn't listed, clickManage connected repositories.While completing this step, do the following, if prompted:
Authenticate to GitHub.
Install Cloud Build on your GitHub account.
If you're selecting a repository for the first time for use withCloud Build in your project, select the checkbox to agree to the terms ofuse policy.
ClickNext.
In theBuild configuration section, enter the following details:
Branch: The default branch is
^main$. Don't update this.Build type: ClickDockerfile.
Source location: Enter the following:
/gemini/sample-apps/gemini-streamlit-cloudrun/Dockerfile
ClickSave.
On theCreate service page, enter the following details in theConfigure section:
Service name: Enter
gemini-streamlit-cloudrun.Authentication: ClickAllow public access.
Service autoscaling: Set theMinimum number of instances to
1.
ClickContainer(s), volumes, networking, security.
In theRevision autoscaling section, enter the following:
Minimum number of instances: Enter
1.Maximum number of instances: Enter
3.
ClickCreate.
Optional: To test the app deployment to Cloud Run, do the following:
On theServices page in Cloud Run, click the service name.
On theService details page, click theURL displayed next to the service name.
Set up an automatic Cloud Build trigger
Navigate to theTriggers page in Cloud Build.
Click the name of your new trigger.
UnderSource, click to expandShow included and ignored files filters.
In theIncluded files filter box, enter
gemini-streamlit-cloudrun/**.ClickSave.
Tip: If you want to manually build the Cloud Run service again, go to theTriggers page and clickRun.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.