Link Search Menu Expand Document

Managing Assets

The platform supports automatically uploading assets to labs, which can be useful in providing additional configuration helpers or short scripts for learners to interact with. What assets get loaded into the lab environment is determined in the index.json file. All assets must be placed in an assets/ directory inside the root of the lab or challenge directory. Any assets that are required by an intro/finish page or step/task must also be placed in the assets/ directory.

NOTE: This feature was designed for configuration files and short scripts; as such, there is a file limit of 9MB per asset file. If the file is greater than 1MB, we recommend using a CDN and cURL to download the file into the lab environment.

For example, if you wanted to include and from the following lab structure:

├── assets
│   ├──
│   ├── example.js
│   ├── picture1.png
│   └──
├── index.json

You would include the following inside the "details" section of your index.json file:

"details": {
    "assets": {
        "host01": [
            {"file": "", "target": "/usr/local/bin/", "chmod": "+x"},
            {"file": "", "target": "/usr/local/bin/", "chmod": "+x"}

The options are as follows:

  • file: The name of the file within the assets directory.
  • target: The directory or location inside the lab environment where the file should be uploaded to.
  • chmod (optional): Automatically set a chmod flag after uploading the file.

Providing Instruction Assets Without Copying them into the Environment

To provide assets such as images to your, and any step or task .md files, all you need to do is put them in the lab/challenge directory’s asssets folder, and then reference them starting at the root of the lab/challenge directory, including the relative . dot. For example, if you had an assets/foo.png file you wanted to show on step one, your file might include the following:

As shown in the following image:

<img src="./assets/foo.png"/>

For these kinds of assets, you do not include them in the "assets" section of "details" in the lab/challenge’s index.json file.

Managing Assets Across the Client and Hosts

Files can be uploaded to the client and/or any of the hosts. The client is the container defined in the index.json file. host01 is where Docker itself is running.

To copy all files to the /root folder in the host01 you can use:

"assets": { "host01": [ {"file": "*", "target": "/root"} ] }

To copy the file example to the home of the client and grant it execution privileges:

"assets": { "client": [{"file": "example", "target": "/root/", "chmod": "+x"}] }