Appearance
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
- Turbo Script files are line-delimited and must contain one instruction per line; line continuation is not supported.
- All lines follow the structure
instruction <args>. - 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 commentComments cannot be inline with a command:
text
# This is a valid comment
layer nodejs/nodejs # This is not a valid commentConditions
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:Windows7Supported expressions include:
host has architecture:x86host has architecture:x64host has os:WindowsXPhost has os:Windows2003host has os:WindowsVistahost has os:Windows2008host has os:Windows7host has os:Windows2008r2host has os:Windows8host has os:Windows2012host has os:Windows8.1host has os:Windows2012r2host 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