Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
In diesem Schritt erstellen Sie einen Cloud Run-Dienst, um die App aus dem Repository bereitzustellen, das Sie im vorherigen Schritt geforkt haben. Außerdem richten Sie einen automatischen Cloud Build-Trigger ein, damit die App jedes Mal erstellt und in Google Cloudbereitgestellt wird, wenn Sie einen neuen Commit in das Repository pushen.
Cloud Run-Dienst mit kontinuierlichem Build erstellen
Rufen Sie in der Google Cloud Console Cloud Run auf.
Wählen Sie Kontinuierlich aus einem Repository bereitstellen.
Klicken Sie auf Mit Cloud Build einrichten.
Wählen Sie in der Liste Repository das verzweigte GitHub-Repository aus, das Sie für Ihre App erstellt haben.
Wenn Ihr Repository nicht aufgeführt ist, klicken Sie auf Verbundene Repositories verwalten.
Gehen Sie bei diesem Schritt so vor, wenn Sie dazu aufgefordert werden:
Authentifizieren Sie sich bei GitHub.
Installieren Sie Cloud Build in Ihrem GitHub-Konto.
Wenn Sie zum ersten Mal ein Repository für die Verwendung mit Cloud Build in Ihrem Projekt auswählen, klicken Sie das Kästchen an, um den Nutzungsbedingungen zuzustimmen.
Klicken Sie auf Weiter.
Geben Sie im Abschnitt Build-Konfiguration die folgenden Details ein:
Branch: Der Standardzweig ist ^main$. Ändern Sie diese Angaben nicht.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["# Step 2: Create a Cloud Run service\n\nIn this step, you create a Cloud Run service to deploy the app from the\nrepository that you forked in the previous step. You also set up an automatic\nCloud Build trigger, so that the app is built and deployed to Google Cloud\nwhenever you push a new commit to the repository.\n\nCreate a Cloud Run service with continuous build\n------------------------------------------------\n\n1. In the Google Cloud console, navigate to Cloud Run.\n\n [Go to Cloud Run](https://console.cloud.google.com/run)\n2. Click **Create service**.\n\n3. Select **Continuously deploy from a repository**.\n\n4. Click **Set up with Cloud Build**.\n\n5. In the **Repository** list, select the forked GitHub repository that you created\n for your app.\n\n If your repository isn't listed, click **Manage connected repositories**.\n While completing this step, do the following, if prompted:\n - Authenticate to GitHub.\n\n - Install Cloud Build on your GitHub account.\n\n6. If you're selecting a repository for the first time for use with\n Cloud Build in your project, select the checkbox to agree to the terms of\n use policy.\n\n7. Click **Next**.\n\n8. In the **Build configuration** section, enter the following details:\n\n - **Branch** : The default branch is `^main$`. Don't update this.\n\n - **Build type** : Click **Dockerfile**.\n\n - **Source location**: Enter the following:\n\n /gemini/sample-apps/gemini-streamlit-cloudrun/Dockerfile\n\n9. Click **Save**.\n\n10. On the **Create service** page, enter the following details in the **Configure** section:\n\n - **Service name** : Enter `gemini-streamlit-cloudrun`.\n\n - **Authentication** : Click **Allow unauthenticated invocations**.\n\n - **Service autoscaling** : Set the **Minimum number of instances** to `1`.\n\n11. Click **Container(s), volumes, networking, security**.\n\n12. In the **Revision autoscaling** section, enter the following:\n\n - **Minimum number of instances** : Enter `1`.\n\n - **Maximum number of instances** : Enter `3`.\n\n13. Click **Create**.\n\n14. Optional: To test the app deployment to Cloud Run, do the following: \n\n 1. On the **Services** page in Cloud Run, click the service name.\n\n [Go to the Services page](https://console.cloud.google.com/run)\n 2. On the **Service details** page, click the **URL** displayed next to the service name.\n\nSet up an automatic Cloud Build trigger\n---------------------------------------\n\n1. Navigate to the **Triggers** page in Cloud Build.\n\n [Go to the Triggers page](https://console.cloud.google.com/cloud-build/triggers)\n2. Click the name of your new trigger.\n\n3. Under **Source** , click to expand **Show included and ignored files filters**.\n\n4. In the **Included files filter** box, enter `gemini-streamlit-cloudrun/**`.\n\n5. Click **Save**.\n\n | **Tip:** If you want to manually build the Cloud Run service again, go to the **Triggers** page and click **Run**."]]