Skip to content

Commit 2194310

Browse files
authored
Merge pull request lf-lang#227 from lf-lang/docker-rti
Description of `rti-image`
2 parents 874b88b + cfaf275 commit 2194310

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

docs/reference/containerized-execution.mdx

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@ target C {
1111
}
1212
```
1313

14-
The generated Docker file has the same name as the LF file except that the extension is `.Dockerfile` and will be put in the `src-gen` directory. You can also specify options. Currently, only the base image (`FROM`) can be customized, but this will be extended to allow further customization is the future. To customize the Docker file, instead of just `true` above, which gives default options, specify the options as in the following example:
14+
The generated Docker file is simply called `Dockerfile` and will be put in the `src-gen` directory. You will need to [install Docker](https://docs.docker.com/get-docker/) in order to use this.
1515

16-
```lf-c
17-
target C {
18-
docker: {FROM: "alpine:latest"}
19-
}
20-
```
21-
22-
This specifies that the base image is the latest version of `alpine`, a very small Linux. In fact, `alpine:latest` is the default value for this option, so you only need to specify this option if you need something other than `alpine:latest`.
23-
24-
How to use this depends on whether your application is federated. You will need to [install Docker](https://docs.docker.com/get-docker/) if you haven't already in order to use this.
2516

2617
## Unfederated Execution
2718
Suppose your LF source file is `src/Foo.lf`. When you run `lfc` or use the IDE to generate code, a file called `Dockerfile` and a file called `docker-compose.yml` will appear in the `src_gen/Foo` directory, see [Structure of an LF project](/docs/handbook/a-first-reactor#structure-of-an-lf-project) for more info.
@@ -104,3 +95,30 @@ The federates `foo` and `bar`, the images of which have already been built, can
10495
docker run -t --rm --network lf foo
10596
docker run -t --rm --network lf bar
10697
```
98+
99+
## Configuration Options
100+
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.
101+
102+
### Select a Base Image
103+
You can specify a base image (`FROM`) as follows:
104+
105+
```lf-c
106+
target C {
107+
docker: {FROM: "alpine:latest"}
108+
}
109+
```
110+
111+
This specifies that the base image is the latest version of `alpine`, a very small Linux. In fact, `alpine:latest` is the default value for this option, so you only need to specify this option if you need something other than `alpine:latest`.
112+
113+
### Select an RTI
114+
By default, an image is pulled from DockerHub that contains the RTI. An alternative image can be specified using the `rti-image` entry as follows:
115+
116+
```lf-c
117+
target C {
118+
docker: {rti-image: "lflang/rti:latest"}
119+
}
120+
```
121+
122+
:::note
123+
To use a local image that is based on source of the RTI provided by `lfc`, use `rti-image: "lflang/rti:rti"`.
124+
:::

0 commit comments

Comments
 (0)