Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Description of rti-image #227

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions docs/reference/containerized-execution.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,8 @@ target C {
}
```

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:
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.

```lf-c
target C {
docker: {FROM: "alpine:latest"}
}
```

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`.

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.

## Unfederated Execution
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.
Expand Down Expand Up @@ -104,3 +95,30 @@ The federates `foo` and `bar`, the images of which have already been built, can
docker run -t --rm --network lf foo
docker run -t --rm --network lf bar
```

## 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.

### Select a Base Image
You can specify a base image (`FROM`) as follows:

```lf-c
target C {
docker: {FROM: "alpine:latest"}
}
```

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`.

### Select an RTI
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:

```lf-c
target C {
docker: {rti-image: "lflang/rti:latest"}
}
```

:::note
To use a local image that is based on source of the RTI provided by `lfc`, use `rti-image: "lflang/rti:rti"`.
:::
Comment on lines +113 to +124
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not explain what rti-image: local means. Also, what is meant by "source of the RTI provided by lfc"? Does lfc' provide source? Also, the syntax lflang/rti:rti` is pretty arcane. What does this mean?

Loading