Container management
Configuration file

Configuration file

The configuration is an optional JavaScript file where you can easily configure some parameters of your project. The file named warp.config.js is a module that exports a default object. Alternatively, you can export a function that return these same objects.

This file is optional because our SDK can detect a basic configuration (if you have a dockerfile for example).

ℹ️

If you use the CLI, the configuration file's values are overridden by the CLI's parameters.

The objects exported can be:

  • a container configuration
  • a server configuration
  • a hosting configuration

Container config

A container config has either a build or an image property. With a build property you will build and deploy a docker image of your own local project. With an image property you will deploy an already existing docker image. If there is no container configuration but there is a dockerfile in your server directory, a default container configuration will be generated.

Example of warp.config.js

module.exports = {
  container: "container",
  build: {
    context: ".",
    dockerfile: "./Dockerfile",
    include: /.*/,
    exclude: /.git/,
  },
  deployment: {
    baseUrl: {
      id: "container",
    },
    configId: "container",
  },
  volumes: {
    id: "html-asset",
    path: "/var/www/html",
  },
};

Attribute list

container

The name of your container. All characters are allowed excepted slash (/).

Default: name of the parent directory of your project if there is one, otherwise container

variables

Set environment variables in the deployments.

See variables.

args

Equivalent to ARG in the docker run command (opens in a new tab)

It will override the default specified in CMD when starting the container.

It can either be a string following the shell syntax. Or an array of string, each of which will be an argument.

build

Mutually exclusive with image.

build.context

The path to the base directory of your project. This path is relative to your configuration file.

Default: .

build.dockerfile

The path to the dockerfile of your project. This path is relative to the context.

build.include

Include all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be included. It will be evaluated relative to the context.

Default: /.*/

build.exclude

Exclude all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be excluded. It will be evaluated relative to the context.

Default: .dockerignore file content if it exist, otherwise /\.git/

image

Mutually exclusive with build.

image.name

The name of the image to start the container from. It must follow this format: [<registry>/][<project>/]<name>[:<tag>|@<digest>].

image.credential
image.credential.login

Login to access the image registry.

image.credential.password

Password to access the image registry.

deployment

deployment.variables

Set environment variables in all deployments. If the same variable is declared in the main variables attribute, then it overrides it.

See variables.

deployment.baseUrl
deployment.baseUrl.id

The ID of the base URL used for the deployment. If your environment doesn't have a base URL with this ID, you will be asked to add one.

Default: container name

deployment.baseUrl.description

A description that will be displayed if you are asked to add a base URL with the provided ID.

deployment.baseUrl.port

The container private port used to serve the URL.

deployment.configId

The ID of the deployment configuration used for the deployment. If your environment doesn't have a deployment configuration with this ID, you will be asked to add one.

Default: container name

volumes

volumes.id

The service volume ID. If your environment doesn't have a volume linked with this service volume ID, you will be asked to add one.

volumes.description

A description that will be displayed if you are asked to add a volume with the service volume ID.

volumes.path

Absolute path to the volume in the container.

volumes.mode

Can be either ro or rw. Specify wether a volume is in a read-only mode (ro) or read-write mode (rw). Note that a volume can be read-write for some containers, and read-only for others.

Default: rw

Server config

If there is no server configuration and no dockerfile but there is a scripts.start attribute in your package.json, a default server configuration will be generated.

Example of warp.config.js

module.exports = {
  server: "server",
  deployment: {
    include: /.*/,
    exclude: /.git/,
    baseUrl: {
      id: "server",
    },
    engine: {
      node: "16",
    },
  },
};

Attribute list

server

The name of your server. All characters are allowed excepted slash (/).

Default: name attribute from the package.json

variables

Set environment variables both in the emulator and in the deployments.

See variables.

deployment

deployment.include

Include all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be included.

Default: /.*/

deployment.exclude

Exclude all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be excluded.

Default: /\.git/, /node_modules/

deployment.baseUrl
deployment.baseUrl.id

The ID of the base URL used for the deployment. If your environment doesn't have a base URL with this ID, you will be asked to add one.

Default: server name

deployment.baseUrl.description

A description that will be displayed if you are asked to add a base URL with the provided ID.

deployment.configId

The ID of the deployment configuration used for the deployment. If your environment doesn't have a deployment configuration with this ID, you will be asked to add one.

Default: server name

deployment.engine

A semver (opens in a new tab) range to specify the engine version. The chosen version will be the latest LTS version in your range. If none are LTS, then it will be the latest version in your range.

engine: {
  node: "16";
}

Default: engines attribute from the package.json. If not defined then default value is the latest LTS version of node.

deployment.variables

Set environment variables in all deployments. If the same variable is declared in the main variables attribute, then it overrides it.

See variables.

Hosting config

If there is no hosting configuration and no dockerfile, but there is either a public or a static directory in your server directory, a default hosting configuration will be generated.

Example of warp.config.js

module.exports = {
  hosting: "hosting",
  public: "public",
  deployment: {
    include: /.*/,
    exclude: [/.git/, /node_modules/],
    baseUrl: {
      id: "hosting",
    },
  },
};

Attribute List

hosting

The name of your hosting. All characters are allowed excepted slash (/).

Default: hosting-[name] with [name] being the name attribute from the package.json

public

The path to a directory containing your assets.

Default: public

deployment

deployment.include

Include all files matching any of these conditions. Conditions can be a RegExp, a path, or a function. In case of a function, it must take a path parameter, and return true if that path should be included.

Default: /.*/

deployment.exclude

Exclude all files matching any of these conditions. Conditions can be a RegExp, a path, or a function. In case of a function, it must take a path parameter, and return true if that path should be excluded.

Default: /\.git/, /node_modules/

deployment.baseUrl
deployment.baseUrl.id

The ID of the base URL used for the deployment. If your environment doesn't have a base URL with this ID, you will be asked to add one.

Default: hosting name

deployment.baseUrl.description

A description that will be displayed if you are asked to add a base URL with the provided ID.

deployment.configId

The ID of the deployment configuration used for the deployment. If your environment doesn't have a deployment configuration with this ID, you will be asked to add one.

Default: hosting name

Variables

The configuration file provides a way to set environment variables in your projects, see variables.