Recipe Instructions
Essential Recipe instructions for configuring workspaces, managing files, installing packages, and cloning repositories.
Available Instructions
Instruction | Description |
---|---|
command | Runs shell commands inside the workspace. |
file | Creates a file with specified content. |
directory | Creates a directory with specified permissions. |
apt-get | Installs packages using the apt-get package manager. |
git-clone | Clones a Git repository into the workspace. |
A recipe is a definition of a workspace. It consists of a base workspace configuration, and a set of steps to be executed. Let's look at a simple recipe:
Steps
Steps while optional are the core tool that you will use to configure your workspace and prepare it for work. Steps can be executed either during build time or launch time. This is accomplished by placing the steps in the corresponding section:
- Build time: Configures the workspace before it starts.
- Launch time: Runs commands when the workspace boots up.
- Run time: Commands executed interactively by the user.
Here, hello_launch
is created at workspace startup, while hello
is created at build time.
Most steps can be moved between the launch and build phases of a recipe. But keep in mind that doing more work during the launch of the container will make your workspace start slower.
Minimize heavy tasks in launch-time steps to avoid slowing down workspace startup.
Recipes support various step types for configuring workspaces. Below are the available step types:
Command
The bread and butter step, pretty much everything you need can be accomplished using this step.
You can have multiline commands, for example:
File
Creates a file with some content.
Paths are not using shell expansion, so you have to write out /home/devzero/projects rather than ~/projects
Directory
Creates a directory.
Same as with files path is not expanded, so ~ and environment variables will not be replaced with corresponding values
Apt Get
Installs apt packages.
The apt-get
package manager is specific to Debian-based distributions
(Ubuntu, Debian). For other operating systems, use: - yum
(CentOS, RHEL) -
dnf
(Fedora) - apk
(Alpine Linux)
Example for Fedora:
We also support an easy way to add extra repositories, for example:
Or:
You can also specify components:
Git Clone
Clones a git repository.
Semantics for the directory are explained in git documentation.
There are Advanced Instructions that we will learn about them, next.