Build Configuration

CloudStation will build and deploy your code with zero configuration, but when necessary, there are several ways to configure this behavior to suit your needs.

Nixpacks Options

CloudStation uses Nixpacks to build your code. It has a variety of options that can be configured with environment variables which can be defined in your services settings. These include things like:

  • Install/build/start commands
  • Nix/Apt packages to install
  • Directories to cache

For a full list of these options, please view the Nixpacks docs.

You can find a complete list of languages we support out of the box here.

Build Context

The build context is the directory that will be used for the build and deployment steps. It defines the working directory from which build processes are executed. Learn more about it

Build Context

Customize the Build Command

With the default Nixpacks builder, you can modify the build command executed during the build process. This option is available in the service settings under the Build section.

Build Command

For those familiar with Nixpacks, this corresponds to the --build-cmd argument used in the Nixpacks build process.

Install a Specific Package Using Nixpacks

When using Nixpacks, you can install specific packages by defining them in a Nixpacks configuration file. For example:

[phases.setup]
    aptPkgs = ['wget']

See the Nixpacks docs for more information.

Build Providers

With Nixpacks, we analyze the app source directory and generate a build plan. This determines which language provider to install packages and runtimes for.

Within your Service's settings, under the Builds section, you can define within the multi-select box which Nixpacks language providers you would like to use for your builds. This is useful if you have code that calls libraries that need to be built from another language within your repo.

When multiple providers are defined, CloudStation will build your service with the language providers (in the order you defined) and ensure your binaries are ready to be called. The runtime(s) will then initialize as soon as you start your application.

Procfiles

If using Nixpacks, you can override the start command with a Procfile at the root of your app. Only a single process type is supported at the moment.

HTTP servers should use the web process type. This process should listen on the PORT environment variable and will receive HTTP traffic.

Note: Some buildpacks specify a default start command.

Specify a Custom Install Command

We do not expose a way to configure a custom install command in the UI, but you can control this using config as code (see Nixpacks Plan -> Install Command).

Disable Build Layer Caching

By default, CloudStation will cache build layers to provide faster build times. If you need to disable this behavior, set the following environment variable in your service:

NO_CACHE=1

Why Isn't My Build Using Cache?

Since CloudStation's build system scales up and down in response to demand, cache hit on builds is not guaranteed.

If you have a need for faster builds and rely on build cache to satisfy that requirement, you should consider creating a pipeline to build your own image and deploy your image directly.


Edit this file on GitHub