When does netlify build run locally and in the remote CI context?
See original GitHub issueThe docs mention:
Like Netlify dev, Netlify build runs locally and in the remote CI context
Can more information be provided about how to know where the build actually happens and whether that’s something that can be controlled?
Also, how does it work in relation to netlify deploy
? Does netlify deploy
run another build?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Get started with Netlify CLI
Run builds locally The command will build your project using environment variables set in netlify. toml and those set using the Netlify UI,...
Read more >Netlify Build
Netlify Build is modern CI/CD infrastructure for frontend teams, pre-configured and fully automated so you can focus on writing code that moves your...
Read more >Build configuration overview - Netlify Docs
Reference basic build settings for a repository using continuous deployment, and understand build image options for your site.
Read more >Build functions - Netlify Docs
Create functions source files in TypeScript, JavaScript, and Go. Use environment variables with functions, manage dependencies, and test locally.
Read more >[Support Guide] Debugging Netlify site builds
Some background. There are a fair number of reasons that a build could fail in Netlify's CI environment, even if building works locally....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We are trying to make local builds as similar as possible with production CI builds. This is a work in progress though and we don’t have a precise list of the small differences between both environments at the moment unfortunately.
If this issue is about https://github.com/netlify/zip-it-and-ship-it/issues/81, please feel free to add more context to that issue directly. Are you using the new Netlify Build beta in production as well, or only through the CLI?
Hi @2color, thanks for reaching out!
There are three ways to trigger a Netlify Build:
@netlify/build
runs a Netlify build programmatically. You can require it from Node.js and call it as a normalasync
function.netlify deploy
command which runs@netlify/build
under the hood.@netlify/build
to run deployments.Builds with
1.
and2.
happen locally (e.g. on your machine) whereas3.
happens inside Netlify production CI.If you are building a Build plugin, the best way to detect this is to use the
IS_LOCAL
constant. If you are simply running shell commands (e.g. insidebuild.command
orbuild.lifecycle
), the best way to detect this is to check whether theNETLIFY
environment variable istrue
.Let me know if that solves your problem!