diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-08-03 07:27:33 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-03 14:39:07 +0000 |
commit | 7462ebe830b256e9e145d133c824de5dfd23045d (patch) | |
tree | d545bb2b4c579108e5fb3ecf2717146a182e65cd /vendor/github.com/projectatomic/buildah/pkg | |
parent | a83f54e9c703630ee95e76b1dac3ad375c44c222 (diff) | |
download | podman-7462ebe830b256e9e145d133c824de5dfd23045d.tar.gz podman-7462ebe830b256e9e145d133c824de5dfd23045d.tar.bz2 podman-7462ebe830b256e9e145d133c824de5dfd23045d.zip |
Vendor in latest github.com/projectatomic/buildah
This adds support for Dockerfile.in and fixes some limits
issues on docker build
Also adds support for podman build to read Dockerfile from stdin.
cat Dockerfile | podman build -f - .
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #1209
Approved by: mheon
Diffstat (limited to 'vendor/github.com/projectatomic/buildah/pkg')
-rw-r--r-- | vendor/github.com/projectatomic/buildah/pkg/parse/parse.go | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/vendor/github.com/projectatomic/buildah/pkg/parse/parse.go b/vendor/github.com/projectatomic/buildah/pkg/parse/parse.go index 26831c7a2..bd333a2cc 100644 --- a/vendor/github.com/projectatomic/buildah/pkg/parse/parse.go +++ b/vendor/github.com/projectatomic/buildah/pkg/parse/parse.go @@ -24,6 +24,7 @@ import ( "github.com/sirupsen/logrus" "github.com/urfave/cli" "golang.org/x/crypto/ssh/terminal" + "golang.org/x/sys/unix" ) const ( @@ -40,6 +41,14 @@ func CommonBuildOptions(c *cli.Context) (*buildah.CommonBuildOptions, error) { memorySwap int64 err error ) + rlim := unix.Rlimit{Cur: 1048576, Max: 1048576} + defaultLimits := []string{} + if err := unix.Setrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil { + defaultLimits = append(defaultLimits, fmt.Sprintf("nofile=%d:%d", rlim.Cur, rlim.Max)) + } + if err := unix.Setrlimit(unix.RLIMIT_NPROC, &rlim); err == nil { + defaultLimits = append(defaultLimits, fmt.Sprintf("nproc=%d:%d", rlim.Cur, rlim.Max)) + } if c.String("memory") != "" { memoryLimit, err = units.RAMInBytes(c.String("memory")) if err != nil { @@ -77,7 +86,7 @@ func CommonBuildOptions(c *cli.Context) (*buildah.CommonBuildOptions, error) { Memory: memoryLimit, MemorySwap: memorySwap, ShmSize: c.String("shm-size"), - Ulimit: c.StringSlice("ulimit"), + Ulimit: append(defaultLimits, c.StringSlice("ulimit")...), Volumes: c.StringSlice("volume"), } if err := parseSecurityOpts(c.StringSlice("security-opt"), commonOpts); err != nil { @@ -531,12 +540,17 @@ func NamespaceOptions(c *cli.Context) (namespaceOptions buildah.NamespaceOptions return options, policy, nil } -func defaultIsolation() buildah.Isolation { - isolation := os.Getenv("BUILDAH_ISOLATION") - if strings.HasPrefix(strings.ToLower(isolation), "oci") { - return buildah.IsolationOCI +func defaultIsolation() (buildah.Isolation, error) { + isolation, isSet := os.LookupEnv("BUILDAH_ISOLATION") + if isSet { + if strings.HasPrefix(strings.ToLower(isolation), "oci") { + return buildah.IsolationOCI, nil + } else if strings.HasPrefix(strings.ToLower(isolation), "chroot") { + return buildah.IsolationChroot, nil + } + return 0, errors.Errorf("unrecognized $BUILDAH_ISOLATION value %q", isolation) } - return buildah.IsolationDefault + return buildah.IsolationDefault, nil } // IsolationOption parses the --isolation flag. @@ -544,9 +558,11 @@ func IsolationOption(c *cli.Context) (buildah.Isolation, error) { if c.String("isolation") != "" { if strings.HasPrefix(strings.ToLower(c.String("isolation")), "oci") { return buildah.IsolationOCI, nil + } else if strings.HasPrefix(strings.ToLower(c.String("isolation")), "chroot") { + return buildah.IsolationChroot, nil } else { return buildah.IsolationDefault, errors.Errorf("unrecognized isolation type %q", c.String("isolation")) } } - return defaultIsolation(), nil + return defaultIsolation() } |