BCL is a simplified configuration script for Bravetools Images.
git clone https://github.com/beringresearch/bcl
cd bcl
go get
go build
cp bcl /usr/local/bin
The minimal structural unit of BCL is an Entry. Each Entry is comprised of functional Blocks. BCL supports five entry types:
- base - describes base requirements for your image, such as base image and location of the image file.
image {
name: "alpine/edge/amd64"
}
base {
image: "alpine/edge/amd64"
location: "public"
}
- system - describes system packages to be installed through a specified package manager.
Supported package managers are
atp
andapk.
// Install bash and python3 using apk manager
system {
apk: ["bash", "python3"]
}
- copy - is specialised entity designed for file and directory transfers between hosts and Brave Images.
The Entity supports multible Blocks. Each Block must be prefaced with a
key
(e.g.Bravefile {...}
) and contain asource
and atarget
. Optionally,action
specifies additional actions to perform once the file or directory has been copied to the image. All actions are executed on an image during build.
copy {
Bravefile {
source: "Bravefile.bcl"
target: "/root/Bravefile.bcl"
action: "chmod 0700 /root/Bravefile.bcl"
}
Bravefile {
source: "Bravefile"
target: "/root/Bravefile"
action: "chmod 0700 /root/Bravefile"
}
}
- run - executes commands on the Brave image during build time. This Entity supports multiple Blocks and a diverse range of syntax.
In its simplest embodiment,
run
Entity supports command, followed by an argument string. For example,
run {
git: "clone https://github.com/beringresearch/bcl"
}
Complex strings are passed as Arrays.
run {
echo: ["\"clone https://github.com/beringresearch/bcl\""]
}
This will print an output:
$ echo "clone https://github.com/beringresearch/bcl"
$ clone https://github.com/beringresearch/bcl
It is also possible to use Arrays to pass multiple complex commands.
run {
bash: ["-c", "curl -sL https://bootstrap.pypa.io/get-pip.py | sudo -E python3.6"]
}
Multi-line strings are also supported:
run {
echo: `\"This will generate a
multiline outout
to the terminal\"`
}
- service - controls image properties, such as name, version, and run-time configuration.
service {
name: "alpine"
version: "1.0"
ip: "10.0.0.1"
ports: "8008:8008"
// Commands and actions to be run after unit is deployed
postdeploy {
copy {
FileName {
source: "/file/or/directory"
target: "/file/or/directory"
action: "chmod 0700 /file/or/directory"
}
}
run {
echo: "Hello World"
}
}
resources {
ram: "4GB"
cpu: 2
gpu: true
}
}
BCL parser supports arbitrary TAB and SPACE placements. This can greatly improve readability:
system {
apk: ["bash", "python3",
"htop", "curl"]
}
Comments are designated as //
and are natively supported by the BCL parser.
// This entire entry will be ignored
//system {
// apk: ["bash", "python3",
// "htop", "curl"]
//}
Assuming that you have generated a BCL file Bravefile.bcl
, to convert it to a conventional Bravefile
run:
$ bcl Bravefile.bcl
The output will generate a Bravefile
in the working directory.