透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Firebase App Hosting
plat_web
Firebase App Hosting 可簡化動態網頁應用程式的開發和部署作業,並提供 GitHub 整合功能,以及與 Authentication、Cloud Firestore 和 Firebase AI Logic 等其他 Firebase 產品的整合功能。App Hosting 內建預先設定的 Next.js 和 Angular 支援,並廣泛支援各種熱門的網頁架構。
開始使用
主要功能
GitHub 整合 |
只要提交 Git 修訂版本,即可推出新版應用程式。
每當您推送至特定分支版本時,App Hosting 都會自動部署。
|
已透過「Google Cloud」備份 |
App Hosting 會使用 Google Cloud 服務條款,並將應用程式部署到您信任的 Google Cloud 產品。應用程式是使用 Cloud Build 建構,在 Cloud Run 上提供服務,並快取在 Cloud CDN 中。Cloud Secret Manager 等整合式服務可確保 API 金鑰安全無虞。
|
大規模推出 AI 輔助功能 |
從使用 Gemini 的 AI 範例開始。
使用 Cloud Secret Manager 保護 API 端點的 API 金鑰,並善用 App Hosting 的串流支援功能,在應用程式中加入生成式 AI 功能時,維持快速的初始載入時間。
|
Firebase 控制台整合 |
在 Firebase 管理中心監控版本和推出情形,隨時掌握最新動態。從 Firebase 控制台存取記錄和指標、新增自訂網域,以及手動觸發推出作業。 |
運作原理
- 使用 Firebase 控制台或 Firebase CLI,在存放區中授權並安裝 Firebase GitHub 應用程式。
- 在 Firebase 控制台或 Firebase CLI 中,建立 Firebase App Hosting 後端,並使用存放區和即時分支進行持續部署。App Hosting 會為後端建立預設的推出政策,以便在變更推送至目標分支時,立即向 100% 的流量推出。
- 將提交內容推送至即時分支時,Google Cloud Developer Connect 會將事件傳送至 Firebase App Hosting。
- 回應這項事件時,Firebase App Hosting 會為連結至存放區的後端建立新的建構作業。
- 首先,Firebase App Hosting 會為您的提交內容建立新的 Cloud Build 建構作業。在這項工作中,Google Cloud 建構套件會判斷應用程式使用的架構,然後建立適合應用程式的容器和設定 (包括環境變數、密碼、最低或最高執行個體數、並行記憶體、CPU 和 VPC 設定)。詳情請參閱App Hosting建構程序。
- Cloud Build 工作完成後,容器會儲存在專為 Firebase App Hosting 建立的 Artifact Registry 存放區中。Firebase App Hosting 接著會使用您的映像檔和設定,在 Cloud Run 服務中新增 Cloud Run 修訂版本。
- Cloud Run 修訂版本完成並通過健康狀態驗證後,Firebase App Hosting 會修改流量設定,將所有新要求導向新的 Cloud Run 修訂版本。此時,推出作業已完成。
- 當要求傳送至 Firebase App Hosting 上託管的網站時,Google Cloud 負載平衡器會提供要求,並啟用 Cloud CDN。未快取的要求會傳送至 Cloud Run 服務。
實作路徑
|
設定 Firebase |
如果您沒有 Firebase 專案,請建立專案,並確認已啟用 Blaze 定價方案。 |
|
設定「App Hosting」 |
使用 Firebase 控制台或 Firebase CLI 建立 App Hosting 後端。這是應用程式的管理資源集合,包括應用程式的 GitHub 存放區連線。 |
|
管理及監控應用程式 |
建立App Hosting後端App Hosting後,應用程式就會在免費子網域上架,您可以在Firebase控制台Firebase中查看發布詳細資料。您可以使用 Google Cloud 控制台查看及搜尋記錄。 |
|
開發應用程式 |
每當有修訂版本推送至使用中的分支版本時,App Hosting 就會自動啟動新的推出作業。 |
後續步驟
- 開始部署應用程式。
- 試試整合代管應用程式與 Firebase Authentication 和 Google AI 功能的App Hosting程式碼研究室:
Next.js |
Angular。}
- 進一步瞭解 App Hosting 支援的各種社群支援架構。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[],[],null,["Firebase App Hosting \nplat_web \n\nFirebase App Hosting streamlines the development and deployment of dynamic\nweb apps, offering GitHub integration and integration with other Firebase\nproducts like Authentication, Cloud Firestore, and Firebase AI Logic.\nApp Hosting has built-in, preconfigured support for Next.js and Angular\nas well as broader support for various popular web frameworks.\n\n[Get started](/docs/app-hosting/get-started)\n\nKey capabilities\n\n|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| GitHub integration | A git commit is all that's needed to roll out a new version of your app. App Hosting can automatically deploy every time you push to a specific branch. |\n| Backed by Google Cloud | App Hosting uses Google Cloud Terms of Service, and deploys your app to Google Cloud products you trust. Apps are built with Cloud Build, served on Cloud Run, and cached in Cloud CDN. Integrated services like Cloud Secret Manager keep your API keys safe. |\n| Ship AI-powered features at scale | Start with AI samples that use Gemini. Protect your API endpoint's API key with Cloud Secret Manager and leverage App Hosting's streaming support to maintain fast initial load times as you add generative AI features into your app. |\n| Firebase console integration | Monitor your builds and rollouts in the Firebase console so you always know what's going on. Access logs and metrics, add a custom domain, and manually trigger rollouts from the Firebase console. |\n\nHow does it work?\n\n1. Using the Firebase console or Firebase CLI, authorize and install the Firebase GitHub app on your repository.\n2. Still in the Firebase console or Firebase CLI, create a Firebase App Hosting backend, with a repository and live branch for continuous deployment. App Hosting creates a default rollout policy for your backend to roll out to 100% of traffic immediately when a change is pushed to the target branch.\n3. When a commit is pushed to your live branch, Google Cloud Developer Connect sends an event to Firebase App Hosting.\n4. Responding to this event, Firebase App Hosting creates a new build for the backend connected to the repository.\n 1. First, Firebase App Hosting creates a new Cloud Build build for your commit. In this job, [Google Cloud buildpacks](https://cloud.google.com/docs/buildpacks/overview) determine which framework is being used in your application to create a container and configuration (including environment variables, secrets, minimum or maximum instances, concurrency memory, CPU, and VPC configuration) that suits your application. See [the App Hosting build process](/docs/app-hosting/build) For more information.\n 2. When the Cloud Build job is complete, your container is stored in an Artifact Registry repository dedicated to Firebase App Hosting. Firebase App Hosting then adds a new Cloud Run Revision to a Cloud Run service using your image and configuration.\n5. Once your Cloud Run Revision is complete and verified healthy, Firebase App Hosting modifies its traffic configuration to point all new requests to your new Cloud Run Revision. At this point, the rollout is complete.\n6. When a request is sent to a website hosted on Firebase App Hosting, the request is served by Google Cloud Load Balancer with Cloud CDN enabled. Uncached requests are sent to your Cloud Run service.\n\nImplementation path\n\n|---|-----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | Set up Firebase | If you don't already have one, create a Firebase project and make sure it has the Blaze pricing plan enabled. |\n| | Set up App Hosting | With the Firebase console or the Firebase CLI, create an App Hosting backend. This is the collection of managed resources for your app, including the connection to the GitHub repository for your app. |\n| | Manage and monitor your app | When you finish creating an App Hosting backend, your app is available on its free subdomain, and you can view details about the rollout in the Firebase console. You can use the [Google Cloud console](https://console.cloud.google.com/logs/query?project=_) to view and search through your logs. |\n| | Develop your app | App Hosting automatically starts a new rollout every time a commit is pushed to your live branch. |\n\nNext steps\n\n- [Get started](/docs/app-hosting/get-started) deploying apps.\n- Try an App Hosting codelab that integrates a hosted app with Firebase Authentication and Google AI features: [Next.js](https://firebase.google.com/codelabs/firebase-nextjs) \\| [Angular](https://firebase.google.com/codelabs/firebase-web).}\n- Learn more about the various [community-supported frameworks](https://firebaseopensource.com/platform/app_hosting) supported by App Hosting."]]