Skip to content

Commit

Permalink
src: update build command help text (#1425)
Browse files Browse the repository at this point in the history
* src: build command help text

* Regen docs
  • Loading branch information
lkingland authored Nov 16, 2022
1 parent 1ca6625 commit 5ca77d3
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 47 deletions.
61 changes: 39 additions & 22 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,49 @@ import (
func NewBuildCmd(newClient ClientFactory) *cobra.Command {
cmd := &cobra.Command{
Use: "build",
Short: "Build a function project as a container image",
Long: `Build a function project as a container image
This command builds the function project in the current directory or in the directory
specified by --path. The result will be a container image that is pushed to a registry.
The func.yaml file is read to determine the image name and registry.
If the project has not already been built, either --registry or --image must be provided
and the image name is stored in the configuration file.
`,
Example: `
# Build from the local directory, using the given registry as target.
# The full image name will be determined automatically based on the
# project directory name
{{.Name}} build --registry quay.io/myuser
Short: "Build a Function",
Long: `
NAME
{{.Name}} build - Build a Function
SYNOPSIS
{{.Name}} build [-r|--registry] [--builder] [--builder-image] [--push]
[--palatform] [-p|--path] [-c|--confirm] [-v|--verbose]
DESCRIPTION
Builds a function's container image and optionally pushes it to the
configured container registry.
By default building is handled automatically when deploying (see the deploy
subcommand). However, sometimes it is useful to build a function container
outside of this normal deployment process, for example for testing or during
composition when integrationg with other systems. Additionally, the container
can be pushed to the configured registry using the --push option.
When building a function for the first time, either a registry or explicit
image name is required. Subsequent builds will reuse these option values.
EXAMPLES
o Build a function container using the given registry.
The full image name will be calculated using the registry and function name.
$ {{.Name}} build --registry registry.example.com/alice
o Build a function container using an explicit image name, ignoring registry
and function name.
$ {{.Name}} build --image registry.example.com/alice/f:latest
# Build from the local directory, specifying the full image name
{{.Name}} build --image quay.io/myuser/myfunc
o Rebuild a function using prior values to determine container name.
$ {{.Name}} build
# Re-build, picking up a previously supplied image name from a local func.yml
{{.Name}} build
o Build a function specifying the Source-to-Image (S2I) builder
$ {{.Name}} build --builder=s2i
# Build using s2i instead of Buildpacks
{{.Name}} build --builder=s2i
o Build a function specifying the Pack builder with a custom Buildpack
builder image.
$ {{.Name}} build --builder=pack --builder-image=cnbs/sample-builder:bionic
# Build with a custom buildpack builder
{{.Name}} build --builder=pack --builder-image cnbs/sample-builder:bionic
`,
SuggestFor: []string{"biuld", "buidl", "built"},
PreRunE: bindEnv("image", "path", "builder", "registry", "confirm", "push", "builder-image", "platform"),
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/func.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ EXAMPLES

### SEE ALSO

* [func build](func_build.md) - Build a function project as a container image
* [func build](func_build.md) - Build a Function
* [func completion](func_completion.md) - Generate completion scripts for bash, fish and zsh
* [func config](func_config.md) - Configure a function
* [func create](func_create.md) - Create a function project
Expand Down
60 changes: 36 additions & 24 deletions docs/reference/func_build.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,55 @@
## func build

Build a function project as a container image
Build a Function

### Synopsis

Build a function project as a container image

This command builds the function project in the current directory or in the directory
specified by --path. The result will be a container image that is pushed to a registry.
The func.yaml file is read to determine the image name and registry.
If the project has not already been built, either --registry or --image must be provided
and the image name is stored in the configuration file.
NAME
func build - Build a Function

SYNOPSIS
func build [-r|--registry] [--builder] [--builder-image] [--push]
[--palatform] [-p|--path] [-c|--confirm] [-v|--verbose]

```
func build
```
DESCRIPTION

### Examples
Builds a function's container image and optionally pushes it to the
configured container registry.

```
By default building is handled automatically when deploying (see the deploy
subcommand). However, sometimes it is useful to build a function container
outside of this normal deployment process, for example for testing or during
composition when integrationg with other systems. Additionally, the container
can be pushed to the configured registry using the --push option.

# Build from the local directory, using the given registry as target.
# The full image name will be determined automatically based on the
# project directory name
func build --registry quay.io/myuser
When building a function for the first time, either a registry or explicit
image name is required. Subsequent builds will reuse these option values.

# Build from the local directory, specifying the full image name
func build --image quay.io/myuser/myfunc
EXAMPLES

# Re-build, picking up a previously supplied image name from a local func.yml
func build
o Build a function container using the given registry.
The full image name will be calculated using the registry and function name.
$ func build --registry registry.example.com/alice

o Build a function container using an explicit image name, ignoring registry
and function name.
$ func build --image registry.example.com/alice/f:latest

# Build using s2i instead of Buildpacks
func build --builder=s2i
o Rebuild a function using prior values to determine container name.
$ func build

# Build with a custom buildpack builder
func build --builder=pack --builder-image cnbs/sample-builder:bionic
o Build a function specifying the Source-to-Image (S2I) builder
$ func build --builder=s2i

o Build a function specifying the Pack builder with a custom Buildpack
builder image.
$ func build --builder=pack --builder-image=cnbs/sample-builder:bionic



```
func build
```

### Options
Expand Down

0 comments on commit 5ca77d3

Please sign in to comment.