viash build

Build an executable from the provided viash config file.

Usage:

viash build config.vsh.yaml -o output [-p docker] [-m] [-s]

Arguments

–config

A viash config file (example: config.vsh.yaml). This argument can also be a script with the config as a header.

-c, --config_mod

Modify a viash config at runtime using a custom DSL. (default = List())

-m, --meta

Print out some meta information at the end.

-o, --output

Path to directory in which the executable and any resources is built to. Default: “output/”. (default = output/)

-p, --platform

Specifies which platform amongst those specified in the viash config to use. If this is not provided, the first platform will be used. If no platforms are defined in the viash config, the native platform will be used. In addition, the path to a platform yaml file can also be specified.

--push

Whether or not to push the container to a Docker registry [Docker platform only].

-s, --setup

Which setup strategy for creating the container to use [Docker platform only].

-w, --write_meta

Write out some meta information to RESOURCES_DIR/viash.yaml at the end.

-h, --help

Show help message

Examples

Building with no arguments

Build a Viash component with only the path to the viash config file as an argument. This will create an ‘output’ directory and generate an executable inside it with the first platform defined in in your config. If no platform is found, the native platform is used:

viash build config.vsh.yaml

Specifying a platform and an output folder

This builds a Viash component based on your viash config file in a ‘bin’ folder that will use Docker to run:

viash build config.vsh.yaml --platform docker --output "bin"

Using a Docker setup strategy post-build

Create a build for the Docker platform and afterwards execute a ---setup with a specific Docker setup strategy.

viash build config.vsh.yaml -p docker --setup alwaysbuild

Build a Viash component for the native platform and output information about the build in the terminal:

viash build config.vsh.yaml -p native --meta

Here’s an example of what the output might look like:

viash version:      0.5.0
config:             config.vsh.yaml
platform:           native
executable:         output/hello_world
output:             output/
remote git repo:    <NA>

Generate a meta file

This builds a Viash component and puts a viash.yaml file next to the executable containing the full configuration information of the component for later reference:

viash build config.vsh.yaml --write_meta

Override a config with config mods

Build a Viash component and use a config mod to override the config file. In this case, pull an image from a docker registry and specify a specific docker registry server URL.

viash build config.vsh.yaml -p docker \
  -c '.platforms[.type == "docker"].setup_strategy := "pull"' \
  -c '.platforms[.type == "docker"].container_registry := "url-to-registry"'

See also