From ce87a52ef4681094d51b61ef4e12e000acfc1443 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Wed, 12 Apr 2017 17:20:42 -0400 Subject: [PATCH] bud: Add flags for specifying the runtime command So long as it's possible to have an incompatible version of runc installed, we're going to want to easily point to another version, as we already allow for with the "run" command. Signed-off-by: Nalin Dahyabhai Closes: #76 Approved by: nalind --- cmd/buildah/bud.go | 20 ++++++++++++++++++++ docs/buildah-bud.md | 4 ++-- docs/buildah-run.md | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/cmd/buildah/bud.go b/cmd/buildah/bud.go index fe5c8a36..ce0df5ea 100644 --- a/cmd/buildah/bud.go +++ b/cmd/buildah/bud.go @@ -8,6 +8,7 @@ import ( "github.com/Sirupsen/logrus" "github.com/containers/storage/pkg/archive" + "github.com/projectatomic/buildah" "github.com/projectatomic/buildah/imagebuildah" "github.com/urfave/cli" ) @@ -39,6 +40,15 @@ var ( Name: "build-arg", Usage: "`argument=value` to supply to the builder", }, + cli.StringFlag{ + Name: "runtime", + Usage: "`path` to an alternate runtime", + Value: buildah.DefaultRuntime, + }, + cli.StringSliceFlag{ + Name: "runtime-flag", + Usage: "add global flags for the container runtime", + }, cli.StringFlag{ Name: "tag, t", Usage: "`tag` to apply to the built image", @@ -77,6 +87,14 @@ func budCmd(c *cli.Context) error { if c.IsSet("pull-always") { pull = c.Bool("pull-always") } + runtimeFlags := []string{} + if c.IsSet("runtime-flag") { + runtimeFlags = c.StringSlice("runtime-flag") + } + runtime := "" + if c.IsSet("runtime") { + runtime = c.String("runtime") + } pullPolicy := imagebuildah.PullNever if pull { @@ -178,6 +196,8 @@ func budCmd(c *cli.Context) error { SignaturePolicyPath: signaturePolicy, Args: args, Output: output, + Runtime: runtime, + RuntimeArgs: runtimeFlags, } return imagebuildah.BuildDockerfiles(store, options, dockerfiles...) diff --git a/docs/buildah-bud.md b/docs/buildah-bud.md index bed7f1fc..12901c2c 100644 --- a/docs/buildah-bud.md +++ b/docs/buildah-bud.md @@ -55,8 +55,8 @@ resulting image's configuration. **--runtime** *path* -The *path* to an alternate runtime, which will be used to run commands -specified by the **RUN** instruction. +The *path* to an alternate OCI-compatible runtime, which will be used to run +commands specified by the **RUN** instruction. **--runtime-flag** *flag* diff --git a/docs/buildah-run.md b/docs/buildah-run.md index 82cdf7f2..88270cc8 100644 --- a/docs/buildah-run.md +++ b/docs/buildah-run.md @@ -16,7 +16,7 @@ the *buildah config* command. **--runtime** *path* -The *path* to an alternate runtime. +The *path* to an alternate OCI-compatible runtime. **--runtime-flag** *flag*