You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/docker-support.mdx
+43-7Lines changed: 43 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Docker Support
3
3
description: Building and running Lingua Franca programs using Docker
4
4
---
5
5
6
-
:::note
6
+
:::tip
7
7
You will need to [install Docker](https://docs.docker.com/get-docker/) in order to use this feature.
8
8
:::
9
9
@@ -137,10 +137,45 @@ If you only want to generated code and configuration files but do not want to th
137
137
By default, `no-build` is `false` and hence building is enabled.
138
138
139
139
### Option `post-build-script`
140
+
If any actions need to be performed at the end of the build stage (such as any cleanups or additional installation steps), you can put these in a shell script and pass it as an option in the `docker` target property. Example:
141
+
142
+
```
143
+
docker: {
144
+
post-build-script: "path/to/post-build.sh"
145
+
}
146
+
```
147
+
148
+
:::note
149
+
The given path should either be relative to the package root or relative to the `.lf` file in which the target property is given.
150
+
:::
140
151
141
152
### Option `pre-build-script`
153
+
If any actions need to be performed at the beginning of the build stage (such as setting environment variables), you can put these in a shell script and pass it as an option in the `docker` target property. Example:
154
+
155
+
```
156
+
docker: {
157
+
pre-build-script: "path/to/pre-build.sh"
158
+
}
159
+
```
160
+
161
+
:::note
162
+
The given path should either be relative to the package root or relative to the `.lf` file in which the target property is given.
163
+
:::
164
+
165
+
### Option `pre-run-script`
166
+
If any actions need to be performed (such as setting environment variables) at the beginning of the entrypoint in the run stage, you can put these in a shell script and pass it as an option in the `docker` target property. Example:
167
+
168
+
169
+
```
170
+
docker: {
171
+
pre-run-script: "path/to/pre-run.sh"
172
+
}
173
+
```
174
+
175
+
:::note
176
+
The given path should either be relative to the package root or relative to the `.lf` file in which the target property is given.
177
+
:::
142
178
143
-
### Option `post-run-script`
144
179
145
180
### Option `runner-base`
146
181
To pick a base image for the run stage in the generated `Dockerfile`, use the `runner-base` option:
@@ -153,7 +188,11 @@ To pick a base image for the run stage in the generated `Dockerfile`, use the `r
153
188
154
189
Note that this will _not_ affect the build stage. To change the base image of the build stage, use the [`builder-base` option](#option-builder-base).
155
190
156
-
By default, `runner-base` is "`alpine:latest`".
191
+
By default, `runner-base` is `"alpine:latest"`. However, if `builder-base` is defined, then `runner-base` defaults to the value that was assigned to `builder-base`.
192
+
193
+
:::tip
194
+
You can also use the builder stage as the base for the running stage (and inherit all the installed dependencies and created build artifacts). To do this, simply use `runner-base: "builder"`.
195
+
:::
157
196
158
197
### Option `rti-image`
159
198
To run a federated program, an RTI process must run to support it. By default, an image for the RTI is pulled from DockerHub. An alternative image can be specified using the `rti-image` entry.
@@ -166,10 +205,7 @@ The value of the `builder-base`, `runner-base`, and `rti-image` entry should fol
166
205
167
206
## Manually building and running
168
207
The generated executable simply invokes `docker compose up --abort-on-container-failure`, but this might not be what you want. Here are some guidelines for building and running manually.
169
-
170
-
:::note
171
-
If you instead want to build manually after code generation has completed, you can instruct to Lingua Franca compiler to skip building using the `no-build` option in the `docker` target property. More information can be found [here](#option-no-build)
172
-
:::
208
+
If you instead want to build manually after code generation has completed, you can instruct to Lingua Franca compiler to skip building using the `no-build` option in the `docker` target property. More information can be found [here](#option-no-build).
173
209
174
210
### Using `docker build` and `docker run`
175
211
You can build images and run containers in separate steps. First, change directory to [the location of the `Dockerfile`](#where-to-find-the-docker-configuration-files).
0 commit comments