Fixed merge conflicts, support multistage builds

This commit is contained in:
Priya Wadhwa
2018-04-26 16:39:02 -07:00
1012 changed files with 5596 additions and 141672 deletions
+13 -12
View File
@@ -25,21 +25,19 @@ import (
"github.com/GoogleContainerTools/kaniko/pkg/constants"
"github.com/GoogleContainerTools/kaniko/pkg/executor"
"github.com/GoogleContainerTools/kaniko/pkg/image"
"github.com/GoogleContainerTools/kaniko/pkg/util"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
var (
dockerfilePath string
destination string
srcContext string
snapshotMode string
bucket string
dockerInsecureSkipTLSVerify bool
logLevel string
force bool
dockerfilePath string
destination string
srcContext string
snapshotMode string
bucket string
logLevel string
force bool
)
func init() {
@@ -48,7 +46,6 @@ func init() {
RootCmd.PersistentFlags().StringVarP(&bucket, "bucket", "b", "", "Name of the GCS bucket from which to access build context as tarball.")
RootCmd.PersistentFlags().StringVarP(&destination, "destination", "d", "", "Registry the final image should be pushed to (ex: gcr.io/test/example:latest)")
RootCmd.PersistentFlags().StringVarP(&snapshotMode, "snapshotMode", "", "full", "Set this flag to change the file attributes inspected during snapshotting")
RootCmd.PersistentFlags().BoolVarP(&dockerInsecureSkipTLSVerify, "insecure-skip-tls-verify", "", false, "Push to insecure registry ignoring TLS verify")
RootCmd.PersistentFlags().StringVarP(&logLevel, "verbosity", "v", constants.DefaultLogLevel, "Log level (debug, info, warn, error, fatal, panic")
RootCmd.PersistentFlags().BoolVarP(&force, "force", "", false, "Force building outside of a container")
}
@@ -72,12 +69,16 @@ var RootCmd = &cobra.Command{
}
logrus.Warn("kaniko is being run outside of a container. This can have dangerous effects on your system")
}
buildImage, err := executor.DoBuild(dockerfilePath, srcContext, snapshotMode)
if err := os.Chdir("/"); err != nil {
logrus.Error(err)
os.Exit(1)
}
ref, image, err := executor.DoBuild(dockerfilePath, srcContext, snapshotMode)
if err != nil {
logrus.Error(err)
os.Exit(1)
}
if err := image.PushImage(buildImage, destination, dockerInsecureSkipTLSVerify); err != nil {
if err := executor.DoPush(ref, image, destination); err != nil {
logrus.Error(err)
os.Exit(1)
}