Skip to content

Commit

Permalink
feat: add docker build provenance flag
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras committed Feb 3, 2024
1 parent 6c16d3e commit ae0b2bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/docker_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type dockerBuildFlags struct {
Profile string `mapstructure:"docker-profile"`
Context string `mapstructure:"docker-context"`
Platform string `mapstructure:"docker-platform"`
Provenance string `mapstructure:"docker-provenance"`
BuildX bool `mapstructure:"docker-buildx"`
SkipDevBuild bool `mapstructure:"docker-skip-dev"`
SkipPull bool `mapstructure:"docker-skip-pull"`
Expand All @@ -38,6 +39,7 @@ func createDockerBuildCmd() *cobra.Command {
addStringFlag(cmd, "docker-profile", "", "", "profile of the Dockerfile.<profile>")
addStringFlag(cmd, "docker-context", "", ".", "the docker build context")
addStringFlag(cmd, "docker-platform", "", "", "the docker build platform")
addStringFlag(cmd, "docker-provenance", "", "", "the provenance attestations include facts about the build process, including details")
addBoolFlag(cmd, "docker-skip-pull", "", false, "skip docker pull new images for the build")
addBoolFlag(cmd, "docker-build-push", "", false, "push docker image after build")
addBoolFlag(cmd, "docker-buildx", "", false, "extended build capabilities with BuildKit")
Expand Down Expand Up @@ -79,11 +81,14 @@ func dockerBuild(project *Project, flags dockerBuildFlags) {
if !flags.SkipPull {
command = append(command, "--pull")
}

// Removing intermediate container
if !flags.SkipRemoveBuild {
command = append(command, "--rm")
}

if len(flags.Provenance) > 0 {
command = append(command, "--provenance", flags.Provenance)
}
if len(flags.Platform) > 0 {
command = append(command, "--platform", flags.Platform)
}
Expand Down

0 comments on commit ae0b2bd

Please sign in to comment.