Skip to content

Barebones implementation of local builds#10101

Open
falahat wants to merge 58 commits intomainfrom
zip_deploy_barebones
Open

Barebones implementation of local builds#10101
falahat wants to merge 58 commits intomainfrom
zip_deploy_barebones

Conversation

@falahat
Copy link
Contributor

@falahat falahat commented Mar 14, 2026

Description

Adds some prototype code for building nextjs apps locally.

Scenarios Tested

  • I created a firebase.json for a test app with local builds enabled
{
  "apphosting": {
    "backendId": "local-build",
    "rootDir": "/",
    "localBuild": true,
    "ignore": [
      "node_modules",
      ".git",
      "firebase-debug.log",
      "firebase-debug.*.log",
      "functions"
    ]
  }
}
  • I enabled the apphostinglocalbuilds flag and tested a local deployment and it was successful. Env vars did not work (as expected) but I was otherwise able to visit the locally built / zip-deployed site.

  • I tested a source deploy app

  • I disabled the apphostinglocalbuilds flag and the CLI correctly failed my deployment with a clear error message.

Sample Commands

firebase deploy

annajowang and others added 30 commits November 22, 2025 01:29
1. Fix for injecting auto-init variables into the build

2. Fixes how we handle dependencies, nodejs paths, modulepaths, etc. This needs closer attention/fixes.

3. Adds env var handling (not secrets) and determines which env vars to pass down to the build
… variants) and include them in the final artifact
…ctually a local build (instead of assuming true.)
…ore strictly. We also remove some hardcoded values and we generalize the code so that it does not affect source deploys.

The goal is to prepare this PR so that we can safely submit it to main (behind the experiment flag.)
…ive. Only run it if it's a local build and the local build experiment flag is enabled.
@falahat
Copy link
Contributor Author

falahat commented Mar 18, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces barebones support for local builds in App Hosting, allowing the deployment of pre-built artifacts. Key changes include updating dependencies, adding a new createTarArchive utility for packaging local build outputs, and modifying the deployment and release processes to differentiate between source and local build deployments. New test cases have been added to cover the local build functionality and experiment flag enforcement. The documentation for localBuild and the main deployment function has also been improved.

@falahat
Copy link
Contributor Author

falahat commented Mar 19, 2026

I manually tested a local build and it was correctly deployed. Of course, env vars didn't work yet but I confirmed that:

  1. We didn't do a Cloud Build for this deployment
  2. The rollout (from CLI) was successful and I saw the new version/rollout on the Firebase Console
  3. I was able to use the deployed nextjs site

@falahat falahat marked this pull request as ready for review March 20, 2026 18:14
@falahat falahat requested a review from Yuangwang March 20, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants