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
Network string
}

func Lookup(file string) (*Dapperfile, error) {
Expand Down Expand Up @@ -253,6 +254,10 @@ func (d *Dapperfile) build(args []string, copy bool) (string, error) {
buildArgs = append(buildArgs, "--build-arg", v)
}

if d.Network != "" {
buildArgs = append(buildArgs, "--network", d.Network)
}

if d.NoContext {
buildArgs = append(buildArgs, "-")
buildArgs = append(buildArgs, args...)
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: "network",
Usage: "The network to use for the build container",
},
}
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.Network = c.String("network")

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