Get started with build configuration

Netlify lets you link a GitHub, GitLab, or Bitbucket repository to a site for continuous deployment. Each time you push to your Git provider, Netlify runs a build with your tool of choice and deploys the result to our powerful CDN.

Basic build settings

You can specify how Netlify will build your site by going to Settings > Build & deploy > Continuous Deployment > Build settings.

From here, you can link an existing site to a Git repository or change the currently linked repository, set a base directory, add a build command, and specify a publish directory. For public repos, you can also toggle your deploy log visibility.

You can also specify some of these build settings and others in a configuration file, which allows you to change your settings depending on the deploy context.

Definitions

  • Base directory: Optional field that specifies the directory to change to before starting a build. This is where we will look for dependency management files such as package.json/.nvmrc/etc. A common use for this field is linking a site to a monorepo (a repository that contains multiple sites or apps, each in its own subdirectory).
  • Build command: If you are using a static site generator or other build tool, this is where you should specify the command to run to build your site. Visit the common configurations doc to learn about typical settings for popular tools and architectures.
  • Publish directory: Directory (relative to the root of your repo) that contains the deploy-ready HTML files and assets generated by the build. If a base directory has been specified, it should be included in the publish directory path. For example, if your base directory is set to site, the publish directory should include the site/ prefix like so: site/public. Visit the common configurations doc to learn about typical settings for popular tools and architectures.

Build image selection

This feature is in BETA.

When a build is triggered on Netlify, our buildbot starts a Docker container running a build image. The build image is a snapshot of an operating system that is preinstalled with various software tools and other settings.

Until recently, all Netlify sites were built using the same build image. We are now experimenting with allowing customers to select from multiple images with different operating system and software versions.

You might choose a different build image to meet a software requirement for your build tool, to try out experimental build features before we release them, or to just keep up to date with the included operating system environment. This will also allow us to release breaking changes into our build image and allow users to accommodate those changes when they have time to upgrade.

All Netlify build images are stored in a public GitHub repository. The repository README includes a list of available images and instructions for testing locally.

To change the build image for a site, go to the site Settings > Build & deploy > Continuous Deployment > Build image selection, and select the build image you would like to use. This image will be used for all production deploys, as well as branch deploys and Deploy Previews.

Build environment variables

Builds settings: Node, NPM, and Yarn

Builds settings: Ruby

Builds settings: Python

Builds settings: Hugo

Builds settings: Bower

Builds settings: Grunt

Builds settings: Additional environment variables

Branches & Deploys

Continuous deployment: Definitions

Branch deploy controls

Deploy Preview controls

Deploy Summary

Status Badges

Deploy Contexts

Skipping a Deploy

Canceling a Deploy

Environment Variables

Environment Variables

Set Node, Ruby, or Python version

Continuous deployment: Node

Continuous deployment: Ruby

Continuous deployment: Python

Continuous deployment: Dependencies

Continuous deployment: Dependency Cache

Monorepo support

Concurrency, queueing, and build time

Common configuration directives

Common build tools

Single page apps