mirror of https://github.com/containers/podman.git
Add authfile, cert-dir and creds params to build
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com> Closes: #280 Approved by: mheon
This commit is contained in:
parent
2dfd048545
commit
03cfe5ebbe
|
@ -11,10 +11,24 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
buildFlags = []cli.Flag{
|
buildFlags = []cli.Flag{
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "authfile",
|
||||||
|
Usage: "path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json",
|
||||||
|
},
|
||||||
cli.StringSliceFlag{
|
cli.StringSliceFlag{
|
||||||
Name: "build-arg",
|
Name: "build-arg",
|
||||||
Usage: "`argument=value` to supply to the builder",
|
Usage: "`argument=value` to supply to the builder",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "cert-dir",
|
||||||
|
Value: "",
|
||||||
|
Usage: "use certificates at the specified path to access the registry",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "creds",
|
||||||
|
Value: "",
|
||||||
|
Usage: "use `[username[:password]]` for accessing the registry",
|
||||||
|
},
|
||||||
cli.StringSliceFlag{
|
cli.StringSliceFlag{
|
||||||
Name: "file, f",
|
Name: "file, f",
|
||||||
Usage: "`pathname or URL` of a Dockerfile",
|
Usage: "`pathname or URL` of a Dockerfile",
|
||||||
|
@ -68,9 +82,18 @@ func buildCmd(c *cli.Context) error {
|
||||||
|
|
||||||
budCmdArgs := []string{"bud"}
|
budCmdArgs := []string{"bud"}
|
||||||
|
|
||||||
|
if c.IsSet("authfile") {
|
||||||
|
budCmdArgs = append(budCmdArgs, "--authfile", c.String("authfile"))
|
||||||
|
}
|
||||||
for _, buildArg := range c.StringSlice("build-arg") {
|
for _, buildArg := range c.StringSlice("build-arg") {
|
||||||
budCmdArgs = append(budCmdArgs, "--build-arg", buildArg)
|
budCmdArgs = append(budCmdArgs, "--build-arg", buildArg)
|
||||||
}
|
}
|
||||||
|
if c.IsSet("cert-dir") {
|
||||||
|
budCmdArgs = append(budCmdArgs, "--cert-dir", c.String("cert-dir"))
|
||||||
|
}
|
||||||
|
if c.IsSet("creds") {
|
||||||
|
budCmdArgs = append(budCmdArgs, "--creds", c.String("creds"))
|
||||||
|
}
|
||||||
for _, fileName := range c.StringSlice("file") {
|
for _, fileName := range c.StringSlice("file") {
|
||||||
budCmdArgs = append(budCmdArgs, "--file", fileName)
|
budCmdArgs = append(budCmdArgs, "--file", fileName)
|
||||||
}
|
}
|
||||||
|
|
|
@ -700,15 +700,18 @@ _podman_build() {
|
||||||
"
|
"
|
||||||
|
|
||||||
local options_with_args="
|
local options_with_args="
|
||||||
--signature-policy
|
--authfile
|
||||||
--runtime
|
--build-arg
|
||||||
--runtime-flag
|
--cert-dir
|
||||||
--tag
|
--creds
|
||||||
-t
|
|
||||||
--file
|
--file
|
||||||
-f
|
-f
|
||||||
--build-arg
|
|
||||||
--format
|
--format
|
||||||
|
--runtime
|
||||||
|
--runtime-flag
|
||||||
|
--signature-policy
|
||||||
|
--tag
|
||||||
|
-t
|
||||||
"
|
"
|
||||||
|
|
||||||
local all_options="$options_with_args $boolean_options"
|
local all_options="$options_with_args $boolean_options"
|
||||||
|
|
|
@ -24,6 +24,11 @@ to do the actual building.
|
||||||
|
|
||||||
## OPTIONS
|
## OPTIONS
|
||||||
|
|
||||||
|
**--authfile** *path*
|
||||||
|
|
||||||
|
Path of the authentication file. Default is ${XDG_RUNTIME\_DIR}/containers/auth.json, which is set using `podman login`.
|
||||||
|
If the authorization state is not found there, $HOME/.docker/config.json is checked, which is set using `docker login`.
|
||||||
|
|
||||||
**--build-arg** *arg=value*
|
**--build-arg** *arg=value*
|
||||||
|
|
||||||
Specifies a build argument and its value, which will be interpolated in
|
Specifies a build argument and its value, which will be interpolated in
|
||||||
|
@ -31,6 +36,16 @@ instructions read from the Dockerfiles in the same way that environment
|
||||||
variables are, but which will not be added to environment variable list in the
|
variables are, but which will not be added to environment variable list in the
|
||||||
resulting image's configuration.
|
resulting image's configuration.
|
||||||
|
|
||||||
|
**--cert-dir** *path*
|
||||||
|
|
||||||
|
Use certificates at *path* (*.crt, *.cert, *.key) to connect to the registry
|
||||||
|
|
||||||
|
**--creds** *creds*
|
||||||
|
|
||||||
|
The [username[:password]] to use to authenticate with the registry if required.
|
||||||
|
If one or both values are not supplied, a command line prompt will appear and the
|
||||||
|
value can be entered. The password is entered without echo.
|
||||||
|
|
||||||
**-f, --file** *Dockerfile*
|
**-f, --file** *Dockerfile*
|
||||||
|
|
||||||
Specifies a Dockerfile which contains instructions for building the image,
|
Specifies a Dockerfile which contains instructions for building the image,
|
||||||
|
@ -96,6 +111,12 @@ podman build --tls-verify=true -t imageName -f Dockerfile.simple
|
||||||
|
|
||||||
podman build --tls-verify=false -t imageName .
|
podman build --tls-verify=false -t imageName .
|
||||||
|
|
||||||
|
podman bud --runtime-flag log-format=json .
|
||||||
|
|
||||||
|
podman bud --runtime-flag debug .
|
||||||
|
|
||||||
|
podman bud --authfile /tmp/auths/myauths.json --cert-dir ~/auth --tls-verify=true --creds=username:password -t imageName -f Dockerfile.simple
|
||||||
|
|
||||||
## SEE ALSO
|
## SEE ALSO
|
||||||
podman(1), buildah(1)
|
podman(1), buildah(1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue