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 <nalin@redhat.com>

Closes: #76
Approved by: nalind
This commit is contained in:
Nalin Dahyabhai
2017-04-12 17:20:42 -04:00
committed by Atomic Bot
parent 1b05c67961
commit ce87a52ef4
3 changed files with 23 additions and 3 deletions

View File

@@ -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...)

View File

@@ -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*

View File

@@ -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*