Skip to content
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
1 change: 1 addition & 0 deletions cmd/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Generator struct {
Workdir string
Env []string
Volumes []string
Ports string
}

func (gen *Generator) Run() error {
Expand Down
1 change: 1 addition & 0 deletions cmd/templates/main.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func main() {
Workdir: "{{.Workdir}}",
Env: {{printf "%#v" .Env}},
Volumes: {{printf "%#v" .Volumes}},
Ports: "{{.Ports}}",
Stdout: ioutil.Discard,
Stderr: os.Stderr,
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/templates/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Shim struct {
Workdir string
Env []string
Volumes []string
Ports string
Stdout io.Writer
Stderr io.Writer
}
Expand Down Expand Up @@ -99,6 +100,10 @@ func (shim *Shim) assembleRunArgs() ([]string, error) {
args = append(args, "-v", volume)
}

if shim.Ports != "" {
args = append(args, "-p", shim.Ports)
}

if shim.Workdir != "" {
cwd, err := os.Getwd()
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func main() {
Aliases: []string{"t"},
Usage: "platforms and architectures to target",
},
&cli.StringFlag{
Name: "ports",
Usage: "ports to use",
},
&cli.StringFlag{
Name: "module",
Usage: "name of generated golang module",
Expand All @@ -77,6 +81,7 @@ func generate(c *cli.Context) error {
Embed: c.Bool("embed"),
Workdir: c.String("workdir"),
Env: c.StringSlice("env"),
Ports: c.String("ports"),
Volumes: c.StringSlice("volume"),
}

Expand Down