Docker Support
You will need to install Docker in order to use this feature.
The C
, Cpp
, Python
, and TypeScript
target allow you to conveniently build and run your Lingua Franca code in a Docker container. To enable this feature, include the docker
property in your target specification, as follows:
When Docker support is enabled, the produced target code will be built inside of a Docker container, and the executable produced in the bin
directory will invoke Docker Compose in order to run the containerized application.
Where to find the Docker configuration files​
Regular LF applications​
For an unfederated application src/Main.lf
, like this:
the following extra Docker-related files are produced:
.
├── bin
│  └── Main
...
└── src-gen
└── Main
...
├── docker-compose.yml
├── Dockerfile
...
Federated LF applications​
A federated version of src/Main.lf
like this:
would produce the following Docker-related files:
.
├── bin
│  └── Main
├── fed-gen
│  └── Main
| ...
│  └── src-gen
│  ├── docker-compose.yml
│  ├── federate__hello1
│  │  ...
│  │  ├── Dockerfile
| ...
│  └── federate__hello2
│  ...
│  ├── Dockerfile
... ...
Configuration options​
You can further customize the generated Docker file through the docker
target property. Instead of just enabling Docker support using true
, specify configuration options in a dictionary.
Option builder-base
​
You can specify a custom base image (used in the Docker FROM
command) for building as follows:
docker: {
builder-base: "ubuntu:latest"
}
The builder-base
option replaces the FROM
option, which is no longer supported in version 0.8.0
and on.
The default is "alpine:latest"
.
Note that the generated Dockerfile
uses a separate build and run stage. The builder-base
applies to the former and also the latter, unless the option runner-base
is specified.