Skip to content

Commit 8539c86

Browse files
committed
Update examples for publish command
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 9023334 commit 8539c86

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

builder/publish.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ func getDockerBuildxCommand(build dockerBuild) (string, []string) {
103103
flagSlice := buildFlagSlice(build.NoCache, build.Squash, build.HTTPProxy, build.HTTPSProxy, build.BuildArgMap,
104104
build.BuildOptPackages, build.BuildLabelMap)
105105

106-
args := []string{"buildx", "build", "--progress=plain", "--platform=" + build.Platforms, "--output=type=registry,push=true"}
106+
// pushOnly defined at https://github.com/docker/buildx
107+
const pushOnly = "--output=type=registry,push=true"
108+
109+
args := []string{"buildx", "build", "--progress=plain", "--platform=" + build.Platforms, pushOnly}
107110

108111
args = append(args, flagSlice...)
109112

commands/publish.go

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,23 @@ var publishCmd = &cobra.Command{
6161
[--regex "REGEX"]
6262
[--filter "WILDCARD"]
6363
[--parallel PARALLEL_DEPTH]
64-
[--publish-arg KEY=VALUE]
65-
[--publish-option VALUE]
64+
[--build-arg KEY=VALUE]
65+
[--build-option VALUE]
6666
[--copy-extra PATH]
6767
[--tag <sha|branch|describe>]
6868
[--platforms linux/arm/v7]`,
69-
Short: "Builds OpenFaaS function containers",
70-
Long: `Builds OpenFaaS function containers either via the supplied YAML config using
71-
the "--yaml" flag (which may contain multiple function definitions), or directly
72-
via flags.`,
73-
Example: ` faas-cli publish -f https://domain/path/myfunctions.yml
74-
faas-cli publish -f ./stack.yml --no-cache --publish-arg NPM_VERSION=0.2.2
75-
faas-cli publish -f ./stack.yml --publish-option dev
76-
faas-cli publish -f ./stack.yml --tag sha
77-
faas-cli publish -f ./stack.yml --tag branch
78-
faas-cli publish -f ./stack.yml --tag describe
79-
faas-cli publish -f ./stack.yml --filter "*gif*"
80-
faas-cli publish -f ./stack.yml --regex "fn[0-9]_.*"
81-
faas-cli publish --image=my_image --lang=python --handler=/path/to/fn/
82-
--name=my_fn --squash
83-
faas-cli publish -f ./stack.yml --publish-label org.label-schema.label-name="value"`,
69+
Short: "Builds and pushes multi-arch OpenFaaS functions",
70+
Long: `Builds and pushes multi-arch OpenFaaS functions using Docker buildx.
71+
A multi-arch template is required. Images will not be available in the
72+
local Docker library. This command only works when a YAML file is specified.
73+
74+
See also: faas-cli build`,
75+
Example: ` faas-cli publish --platforms linux/amd64,linux/arm64,linux/arm/7
76+
faas-cli publish --platforms linux/arm/7 --filter webhook
77+
faas-cli publish -f go.yml --no-cache --build-arg NPM_VERSION=0.2.2
78+
faas-cli publish --build-option dev
79+
faas-cli publish --tag sha
80+
`,
8481
PreRunE: preRunBuild,
8582
RunE: runPublish,
8683
}

0 commit comments

Comments
 (0)