mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-18 04:46:31 +02:00
Add --single-snapshot flag to snapshot once after the build
This commit is contained in:
@@ -40,6 +40,7 @@ var (
|
||||
force bool
|
||||
buildArgs multiArg
|
||||
tarPath string
|
||||
singleSnapshot bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -54,6 +55,7 @@ func init() {
|
||||
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")
|
||||
RootCmd.PersistentFlags().StringVarP(&tarPath, "tarPath", "", "", "Path to save the image in as a tarball instead of pushing")
|
||||
RootCmd.PersistentFlags().BoolVarP(&singleSnapshot, "single-snapshot", "", false, "Set this flag to take a single snapshot at the end of the build.")
|
||||
}
|
||||
|
||||
var RootCmd = &cobra.Command{
|
||||
@@ -79,7 +81,13 @@ var RootCmd = &cobra.Command{
|
||||
logrus.Error(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
ref, image, err := executor.DoBuild(dockerfilePath, srcContext, snapshotMode, buildArgs)
|
||||
ref, image, err := executor.DoBuild(executor.KanikoBuildArgs{
|
||||
DockerfilePath: dockerfilePath,
|
||||
SrcContext: srcContext,
|
||||
SnapshotMode: snapshotMode,
|
||||
Args: buildArgs,
|
||||
SingleSnapshot: singleSnapshot,
|
||||
})
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user