Skip to content

Commit 8baed39

Browse files
LucasRoesleralexellis
authored andcommitted
Document build_options, readonly_root_filesystem, skip_build
**What** - Update the yaml reference with documentation for build_options, readonly_root_filesystem, skip_build Resolves #80 Signed-off-by: Lucas Roesler <[email protected]>
1 parent ff4fd72 commit 8baed39

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

docs/reference/yaml.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,25 @@ The function `handler` field refers to a folder where the function's source code
5757

5858
The `image` field refers to a Docker image reference, this could be on the Docker Hub, in your local Docker library or on another remote server.
5959

60+
#### Function: Skip build
61+
62+
The `skip_build` field controls if the CLI will attempt to build the Docker image for the function. When `true`, the build step is skipped and you should see a message printed to the terminal `Skipping build of: "function name"`.
63+
64+
This value is set as a boolean.
65+
66+
#### Function: Build Options
67+
68+
The `build_options` allows you to pass a list of [Docker build arguments](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg) to the build process. When the language template supports it, this allows you to customize the build without modifying the underlying template.
69+
70+
For example, the [official python3 language template](https://github.com/openfaas/templates/blob/master/template/python3/Dockerfile) allows passing additional Alpine `apk` packages to be installed during build process. To isntall the [`ca-certificates`](https://pkgs.alpinelinux.org/package/edge/main/x86_64/ca-certificates) package for your `python3` function, you can specify
71+
72+
```yaml
73+
build_options:
74+
- ca-certificates
75+
```
76+
77+
Important note: that the configuration of this value is dependent on the language template.
78+
6079
#### Function: Environmental variables
6180

6281
You can set configuration via environmental variables either in-line within the YAML file or in a separate external file. Do not store confidential or private data in environmental variables. See: secrets.
@@ -108,6 +127,14 @@ secrets:
108127
- s3_secret_key
109128
```
110129

130+
#### Function: Read-Only Root Filesystem
131+
132+
The `readonly_root_filesystem` indicates that the function file system will be set to read-only except for a scratch/temporary folder `/tmp`. This prevents the function from writing to or modifying the filesystem (e.g. system files). This is used to provide stricter security for your functions. You can set this value as a boolean:
133+
134+
```yaml
135+
readonly_root_filesystem: true
136+
```
137+
111138
#### Function: Constraints
112139

113140
Constraints are passed directly to the underlying container orchestrator. They allow you to pin a function to certain host or type of host.
@@ -128,7 +155,7 @@ Or only using nodes running with Windows:
128155

129156
#### Function: Labels
130157

131-
Labels can be applied through a map which is passed directly to the container scheduler.
158+
Labels can be applied through a map which is passed directly to the container scheduler.
132159
Labels are also available from the OpenFaaS REST API for querying or grouping functions.
133160

134161
Example of using a label to group by user or apply a `canary` label:
@@ -139,10 +166,10 @@ Example of using a label to group by user or apply a `canary` label:
139166
Git-Owner: alexellis
140167
```
141168

142-
> Important note: When used with a Kubernetes provider, labels support a restricted character set and length.
143-
*"Valid label values must be 63 characters or less and must be empty or begin and end with an alphanumeric character
169+
> Important note: When used with a Kubernetes provider, labels support a restricted character set and length.
170+
*"Valid label values must be 63 characters or less and must be empty or begin and end with an alphanumeric character
144171
([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between."*
145-
>
172+
>
146173
>See [Syntax and character set](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set)
147174
for more information
148175

0 commit comments

Comments
 (0)