Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the proper CONTEXT for local builds? #792

Closed
ehmicky opened this issue Feb 20, 2020 · 6 comments · Fixed by #849
Closed

What's the proper CONTEXT for local builds? #792

ehmicky opened this issue Feb 20, 2020 · 6 comments · Fixed by #849
Assignees
Labels
enhancement New feature or request

Comments

@ehmicky
Copy link
Contributor

ehmicky commented Feb 20, 2020

When builds are run locally (through the Netlify CLI or programmatically), should the CONTEXT be:

  1. production?
  2. A new context such as local?

One concern I have with using production is that users might have production settings (URLs, databases, etc.) that should not be used on local machines. Having a separate local context would allow users to distinguish between both environment in their configuration file (with the context.* property).

What are your thoughts?
@DavidWells @verythorough @kitop @fool

@DavidWells
Copy link
Contributor

Here is a related CLI issue netlify/cli#275

It should work similar to the netlify deploy. Right now the default is preview-deploy unless the --prod flag is passed.

However, when you run a local build, it makes the most sense to build for prod because the next step in the flow would be netlify deploy

The ideal CI flow would be:

netlify build # builds for prod (same as netlify build --context prod)
netlify deploy --prod # deploys to prod (same as netlify build --context prod)

@ehmicky
Copy link
Contributor Author

ehmicky commented Feb 20, 2020

Since netlify build and netlify deploy are two stages of the same process, shouldn't they share the same logic when it comes to contexts?

  • netlify build: context preview-deploy
  • netlify build --prod: context production

@DavidWells
Copy link
Contributor

I don’t think so. ‘netlify build’ should run the prod build

@erquhart
Copy link
Contributor

Agreed w/ @DavidWells - when running build through the CLI, build feels less like a distinct binary and more like a command. It helps to think of it this way:

  • netlify dev: builds for local development
  • netlify build: builds for production

Frontend devs are used to build scripts producing production builds.

@ehmicky ehmicky added enhancement New feature or request and removed Discussion labels Feb 27, 2020
@ehmicky
Copy link
Contributor Author

ehmicky commented Feb 27, 2020

Sounds good. Done at #849.

@askrzypczak
Copy link

is it safe to say that netlify dev should NOT have context=production?

I recently updated to 3.7.1 from 2.70 and this is breaking my dev environment. the netliy.toml context.production.environment is being injected into my dev env.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants