App Hosting のビルドプロセス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Firebase App Hosting は Cloud Build を使用して、アプリケーションのソースコードを Cloud Run へのデプロイに適したコンテナ化された形式に変換します。
ビルドプロセスは、次の主要なステージで動作します。
取り込み: アプリケーションのソースコードと構成を収集します。
ビルド: 依存関係をインストールし、アプリケーションをビルドします。
ハンドオフ: 本番環境の Cloud Run コンテナを確定します。
これらの 3 つのステップは、Google Cloud コンソールの Cloud Build に表示されるビルドステップ 1、2、3 に直接対応しています。

取り込みステージ
このステージは、ビルド前のロジックの処理を担当します。ユーザー定義の環境変数を読み取り、サニタイズして書き込みます。また、apphosting.yaml
ファイルで指定されたシークレットの参照を解除して固定します。
ビルド ステージ
これはビルドプロセスのコアであり、実行可能なコンテナ イメージと、ビルド構成を定義する bundle.yaml
ファイルを生成します。Cloud Native Buildpacks を使用して、アプリケーションを効率的にパッケージ化します。bundle.yaml
ファイルの詳細については、github をご覧ください。
Buildpack は、アプリケーションのソースコードを本番環境に対応したコンテナ イメージに変換します。Firebase App Hosting は、複数の Buildpack を連結してビルドプロセスを完了します。
- ランタイム Buildpack: 基本的な Node.js アプリケーションの実行に必要なすべてのコンポーネントが含まれ、依存関係がインストールされていることを確認します。
- Monorepo Buildpack: さまざまな monorepo シナリオを処理するように後続の Buildpack を構成します。
Framework Buildpack: 正しいフレームワーク アダプタ(Angular や Next.js など)をインストールし、後続の Buildpack を準備します。
フレームワーク アダプターは、本番環境用のビルドコマンドを実行し、関連するフレームワーク固有の構成値を App Hosting が読み取れる標準形式にマッピングします。
パッケージ マネージャー Buildpack: npm、yarn、pnpm を使用して、依存関係のインストールを実行し、アプリをビルドします。
出力バンドル Buildpack: 実行コマンドを定義し、実行用の出力バンドルを準備します。
引き継ぎステージ
この最終段階では、アプリケーションのソースコードから抽出されたすべての情報とビルド コンテナ イメージをパッケージ化して、App Hosting バックエンドに送信します。App Hosting バックエンドは、この情報を使用して適切な構成で Cloud Run を設定します。
詳細
App Hosting のビルドプロセス全体がオープンソースです。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-08 UTC。
[null,null,["最終更新日 2025-08-08 UTC。"],[],[],null,["\u003cbr /\u003e\n\nFirebase App Hosting utilizes Cloud Build to transform your\napplication source code into a containerized format suitable for deployment on\nCloud Run.\n\nThe build process operates through the following key stages:\n\n1. **Ingest**: Gathers your application source code and configuration.\n\n2. **Build**: Installs dependencies and builds your application.\n\n3. **Handoff** : Finalizes the production Cloud Run container.\n\nThese three steps correspond directly to build steps 1, 2 and 3 as displayed in\nCloud Build in the Google Cloud Console:\n\nIngest stage\n\nThis stage is responsible for handling pre-build logic. It reads, sanitizes, and\nwrites user-defined environment variables. It also dereferences and pins any\nsecrets specified in the `apphosting.yaml` file.\n\nBuild stage\n\nThis is the core of the build process, responsible for generating a runnable\ncontainer image and a `bundle.yaml` file defining your build configuration.\nIt utilizes [Cloud Native Buildpacks](https://cloud.google.com/docs/buildpacks/overview)\nto package the\napplication efficiently. More information on the `bundle.yaml`file can be found\non [github](https://github.com/FirebaseExtended/firebase-framework-tools).\n\nBuildpacks are responsible for transforming your application source code into\nproduction ready container images. Firebase App Hosting chains together\nseveral buildpacks to complete the build process:\n\n1. **Runtime Buildpack**: Ensures all necessary components for running a basic Node.js application are included and dependencies are installed.\n2. **Monorepo Buildpack**: Configures subsequent buildpacks to handle different monorepo scenarios.\n3. **Framework Buildpack**: Installs the correct framework adapter (like\n Angular or Next.js) and prepares subsequent buildpacks.\n\n Framework adapters are in charge of running the productionized build\n command and mapping any relevant framework-specific config values to a\n standard format readable by App Hosting.\n4. **Package Manager Buildpack**: Executes the installation of dependencies and\n builds the app using npm, yarn, or pnpm.\n\n5. **Output Bundle Buildpack**: Defines the run command and prepares the output\n bundle for execution.\n\nHandoff stage\n\nThis final stage packages all the information extracted from the application\nsource code plus the build container image and sends it to the App Hosting\nbackend. The App Hosting backend then uses this information to set up\nCloud Run with the proper configurations.\n\nLearn more\n\nThe entire App Hosting build process is open source.\n\n- The buildpack code is in [the Google Cloud buildpacks repo](https://github.com/GoogleCloudPlatform/buildpacks)\n- Code for framework adapters is in the [firebase-framework-tools repo](https://github.com/FirebaseExtended/firebase-framework-tools)\n- Learn more about [Cloud Native buildpacks](https://cloud.google.com/docs/buildpacks/overview) and [Cloud Build](https://cloud.google.com/build/docs/overview)"]]