Zero to 'hello world' in five minutes:
Create a new folder for your project.
Download the latest version of
batect.cmdfrom the releases page, and copy these scripts into your project folder.
Note that you only need the scripts - you don't need to download
If you're on Linux or macOS, make sure the script is executable: run
chmod +x batect.
Create a file called
batect.ymland add this container definition:batect.ymlcontainers:my-container:image: alpine:3.11.3
This container defines the environment our task will run in. In this case, we're using an Alpine Linux image.
After that container definition, add a task:batect.ymlcontainers:my-container:image: alpine:3.11.3tasks:say-hello:description: Say hello to the nice person reading the Batect documentationrun:container: my-containercommand: echo 'Hello world!'
This task defines what to do when the task is run. In this case, it'll just print a "Hello world!" message.
Open a terminal, change to the project folder and run
./batect --list-tasks. You should see output similar to the following:"$ ./batect --list-tasksAvailable tasks:- say-hello: Say hello to the nice person reading the Batect documentation
--list-tasksis available in every Batect project, and makes it easy for your team to discover what tasks are available to them.
Now let's run the task with
./batect say-hello. You should see output similar to the following:$ ./batect say-helloRunning say-hello...my-container: running echo 'Hello world!'Hello world!say-hello finished with exit code 0 in 1.2s.