Skip to content
This repository was archived by the owner on Apr 13, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type Dapperfile struct {
NoContext bool
MountSuffix string
Target string
Secret string
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple secrets should be allowed, so this should be a slice of strings.

}

func Lookup(file string) (*Dapperfile, error) {
Expand Down Expand Up @@ -249,6 +250,10 @@ func (d *Dapperfile) build(args []string, copy bool) (string, error) {
buildArgs = append(buildArgs, "--target", d.Target)
}

if d.Secret != "" {
buildArgs = append(buildArgs, "--secret", d.Secret)
}

for _, v := range d.Args {
buildArgs = append(buildArgs, "--build-arg", v)
}
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ func main() {
Name: "target",
Usage: "The multistage build target to use",
},
cli.StringFlag{
Name: "secret",
Usage: " Secret to expose to the build (format: id=mysecret[,src=/local/secret])",
},
}
app.Action = func(c *cli.Context) {
exit(run(c))
Expand Down Expand Up @@ -131,6 +135,7 @@ func run(c *cli.Context) error {
dapperFile.NoContext = c.Bool("no-context")
dapperFile.MountSuffix = c.String("mount-suffix")
dapperFile.Target = c.String("target")
dapperFile.Secret = c.String("secret")

if shell {
return dapperFile.Shell(c.Args())
Expand Down