@@ -20,32 +20,49 @@ import (
2020func NewBuildCmd (newClient ClientFactory ) * cobra.Command {
2121 cmd := & cobra.Command {
2222 Use : "build" ,
23- Short : "Build a function project as a container image" ,
24- Long : `Build a function project as a container image
25-
26- This command builds the function project in the current directory or in the directory
27- specified by --path. The result will be a container image that is pushed to a registry.
28- The func.yaml file is read to determine the image name and registry.
29- If the project has not already been built, either --registry or --image must be provided
30- and the image name is stored in the configuration file.
31- ` ,
32- Example : `
33- # Build from the local directory, using the given registry as target.
34- # The full image name will be determined automatically based on the
35- # project directory name
36- {{.Name}} build --registry quay.io/myuser
23+ Short : "Build a Function" ,
24+ Long : `
25+ NAME
26+ {{.Name}} build - Build a Function
27+
28+ SYNOPSIS
29+ {{.Name}} build [-r|--registry] [--builder] [--builder-image] [--push]
30+ [--palatform] [-p|--path] [-c|--confirm] [-v|--verbose]
31+
32+ DESCRIPTION
33+
34+ Builds a function's container image and optionally pushes it to the
35+ configured container registry.
36+
37+ By default building is handled automatically when deploying (see the deploy
38+ subcommand). However, sometimes it is useful to build a function container
39+ outside of this normal deployment process, for example for testing or during
40+ composition when integrationg with other systems. Additionally, the container
41+ can be pushed to the configured registry using the --push option.
42+
43+ When building a function for the first time, either a registry or explicit
44+ image name is required. Subsequent builds will reuse these option values.
45+
46+ EXAMPLES
47+
48+ o Build a function container using the given registry.
49+ The full image name will be calculated using the registry and function name.
50+ $ {{.Name}} build --registry registry.example.com/alice
51+
52+ o Build a function container using an explicit image name, ignoring registry
53+ and function name.
54+ $ {{.Name}} build --image registry.example.com/alice/f:latest
3755
38- # Build from the local directory, specifying the full image name
39- {{.Name}} build --image quay.io/myuser/myfunc
56+ o Rebuild a function using prior values to determine container name.
57+ $ {{.Name}} build
4058
41- # Re-build, picking up a previously supplied image name from a local func.yml
42- {{.Name}} build
59+ o Build a function specifying the Source-to-Image (S2I) builder
60+ $ {{.Name}} build --builder=s2i
4361
44- # Build using s2i instead of Buildpacks
45- {{.Name}} build --builder=s2i
62+ o Build a function specifying the Pack builder with a custom Buildpack
63+ builder image.
64+ $ {{.Name}} build --builder=pack --builder-image=cnbs/sample-builder:bionic
4665
47- # Build with a custom buildpack builder
48- {{.Name}} build --builder=pack --builder-image cnbs/sample-builder:bionic
4966` ,
5067 SuggestFor : []string {"biuld" , "buidl" , "built" },
5168 PreRunE : bindEnv ("image" , "path" , "builder" , "registry" , "confirm" , "push" , "builder-image" , "platform" ),
0 commit comments