Skip to content

Turbo Script

Turbo command processor can act as an automated builder by reading instructions from a .me file to create a new image. Turbo Shell can act as an interactive interpreter of Turbo Script.

What You'll Learn

  • How Turbo Script instructions are executed and committed.
  • How to format instructions, comments, and conditions.
  • How Turbo Script selects and applies instructions across different host environments.

Using Turbo Script

A .me script is a text file containing a set of instructions that Turbo follows to create a container. At the end of the script, Turbo creates a new image from the container and deletes the container.

The syntax of a Turbo Script follows this pattern:

text
instruction <arg 1> <arg 2> ...
instruction <arg 1> <arg 2> ...
instruction <arg 1> <arg 2> ...

Scripts run top-to-bottom and are not case-sensitive. All scripts have an implicit commit at the end. If you do not pass a name to the build command with -n or --name, the new image is created with its ID as the name.

Syntax Rules

  1. Turbo Script files are line-delimited and must contain one instruction per line; line continuation is not supported.
  2. All lines follow the structure instruction <args>.
  3. Inline comments are not supported; comments apply to the entire line.

Comments

Comments are denoted by the # character and must begin a line.

text
# This is a comment

Comments cannot be inline with a command:

text
# This is a valid comment

layer nodejs/nodejs  # This is not a valid comment

Conditions

You can add an optional when clause at the end of any instruction to specify the conditions that must be met before it executes. The general form is instruction when expression.

text
cmd "echo This is Windows7" when host has os:Windows7

Supported expressions include:

  • host has architecture:x86
  • host has architecture:x64
  • host has os:WindowsXP
  • host has os:Windows2003
  • host has os:WindowsVista
  • host has os:Windows2008
  • host has os:Windows7
  • host has os:Windows2008r2
  • host has os:Windows8
  • host has os:Windows2012
  • host has os:Windows8.1
  • host has os:Windows2012r2
  • host has os:Windows10

Client and server editions are treated the same (for example, Windows7 is equivalent to Windows2008r2). Combine expressions with AND, OR, NOT, and parentheses.

text
layer clean when (not host has os:windows7 and not host has os:windows8.1)
layer spoonbrew/iis7-base when host has os:windows7
layer spoonbrew/iis8-base when host has os:windows8.1