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: content/en/docs/concepts/function_build.md
+22-9Lines changed: 22 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,15 @@ linkTitle: "Function Build"
4
4
weight: 3110
5
5
description:
6
6
---
7
-
Currently, OpenFunction builds function images with[Cloud Native Buildpacks](https://buildpacks.io/). The traditional `Dockerfile` build method will be supported in the future.
7
+
Currently, OpenFunction supports building function images using[Cloud Native Buildpacks](https://buildpacks.io/) without the need to create a `Dockerfile`.
8
8
9
-
## Build functions by adding a build section in the function definition
9
+
In the meantime, you can also use OpenFunction to build [Serverless Applications](./serverless_apps/#build-and-run-a-serverless-application-with-a-dockerfile) with `Dockerfile`.
10
+
11
+
## Build functions by defining a build section
12
+
13
+
You can build your functions or applications from the source code in a git repo or from the source code stored locally.
14
+
15
+
### Build functions from source code in a git repo
10
16
11
17
You can build a function image by simply adding a build section in the `Function` definition like below.
12
18
If there is a serving section defined as well, the function will be launched as soon as the build completes.
@@ -42,19 +48,26 @@ spec:
42
48
43
49
### Build functions from local source code
44
50
45
-
To build functions from local source code, we need a bundle image which contains the source code.
46
-
We can use the following `Dockerfile` to build a bundle image.
51
+
To build functions or applications from local source code, you'll need to package your local source code into a container image and push this image to a container registry.
52
+
53
+
Suppose your source code is in the `samples` directory, you can use the following `Dockerfile` to build a source code bundle image.
47
54
48
55
```shell
49
56
FROM scratch
50
-
51
57
WORKDIR /
52
58
COPY samples samples/
53
59
```
54
60
55
-
> We suggest using a empty image such as `scratch` as the base image of the bundle image, a non-empty base image may cause the source code copy to fail.
61
+
Then you can build the source code bundle image like this:
> It's recommended to use the empty image `scratch` as the base image to build the source code bundle image, a non-empty base image may cause the source code copy to fail.
56
69
57
-
The `srcRepo` of function should be changed like this.
70
+
Unlike defining the `spec.build.srcRepo.url` field for the git repo method, you'll need to define the `spec.build.srcRepo.bundleContainer.image` field instead.
0 commit comments