Squash YAML: Docker specific fields

Back to the Squash YAML file page.

The Docker based build process

Here is a sample of a Squash YAML file with two applications within the same repo. Each application requires  its own Dockerfile or docker-compose file.

deployments:
  CRM:
    filename:
      ./src/crm/Dockerfile
    context_path:
      ./src
    vm_size:
      1GB
  CoreApp:
    filename:
      ./src/coreapp/docker-compose.yml
    context_path:
      ./src
    vm_size:
      2GB

Supported YAML fields

The YAML fields below are supported on Docker based deployments only.

build_options

  • Additional options that will be added to either the docker build or docker-compose build commands.
  • Mandatory field: No
  • Data Type: String
  • Default value: null

context_path

  • Used for Dockerfile deployments only. Defines the context path option, by default value is ‘.’.
  • Mandatory field: No
  • Data Type: String
  • Default value: ‘.’

dockerfileonly

  • Forces to ignore any available docker-compose files and use a Dockerfile instead. By default, this option is defined automatically.
  • Mandatory field: No
  • Data Type: Boolean
  • Default value: True

dockerimage

  • Defines a docker image that should be used for the docker run command instead of building an image from Dockerfile. This accepts any images from the Docker Public registry or images from a private registry (see “docker_registry” field below) – if the docker_registry field is defined.
  • Mandatory field: No
  • Data Type: String
  • Default value: null

docker_registry

  • Allows to pull docker images from specified private registry server.
  • Mandatory field: No
  • Data Type: dict
  • Default value: null
  • Required fields:
    • username
    • password

.squash.yml sample:

deployments:
  MyAppName:
        dockerimage:
            your_dockerimage_name
        docker_registry:
            server: example.io
            username: your_username
            password: $REGISTRY_PASSWORD

For the example above, $REGISTRY_PASSWORD has been defined in Squash itself using environment variables.

filename

  • This is the full path of a Dockerfile name or docker-compose.yml file
  • Mandatory field: No
  • Data Type: String or List (see examples below)
  • Default value: null

Example using a Dockerfile:

deployments:
  MyApp:
    filename:
      ./src/Dockerfile

docker-compose example:

deployments:
  MyApp:
    filename:
      ./docker-compose.yml

You may also specify multiple docker-compose files, this is handy when sharing configurations between files:

deployments:
  MyApp:
    filename:
        - ./docker-compose-base.yml
        - ./docker-compose-app.yml

Squash will use the docker-compose files in the order specified, from top to bottom. For the example above the first file would be docker-compose-base.yml.