diff --git a/pkg/cli/predict.go b/pkg/cli/predict.go index d4e8dec674..519930f079 100644 --- a/pkg/cli/predict.go +++ b/pkg/cli/predict.go @@ -24,6 +24,7 @@ import ( ) var ( + envFlags []string inputFlags []string outPath string ) @@ -49,6 +50,7 @@ the prediction on that.`, cmd.Flags().StringArrayVarP(&inputFlags, "input", "i", []string{}, "Inputs, in the form name=value. if value is prefixed with @, then it is read from a file on disk. E.g. -i path=@image.jpg") cmd.Flags().StringVarP(&outPath, "output", "o", "", "Output path") + cmd.Flags().StringArrayVarP(&envFlags, "env", "e", []string{}, "Environment variables, in the form name=value") return cmd } @@ -110,6 +112,7 @@ func cmdPredict(cmd *cobra.Command, args []string) error { GPUs: gpus, Image: imageName, Volumes: volumes, + Env: envFlags, }) go func() { diff --git a/pkg/cli/run.go b/pkg/cli/run.go index 06c29f490d..b15e36c6d2 100644 --- a/pkg/cli/run.go +++ b/pkg/cli/run.go @@ -31,6 +31,7 @@ func newRunCommand() *cobra.Command { // This is called `publish` for consistency with `docker run` cmd.Flags().StringArrayVarP(&runPorts, "publish", "p", []string{}, "Publish a container's port to the host, e.g. -p 8000") + cmd.Flags().StringArrayVarP(&envFlags, "env", "e", []string{}, "Environment variables, in the form name=value") flags.SetInterspersed(false) @@ -55,6 +56,7 @@ func run(cmd *cobra.Command, args []string) error { runOptions := docker.RunOptions{ Args: args, + Env: envFlags, GPUs: gpus, Image: imageName, Volumes: []docker.Volume{{Source: projectDir, Destination: "/src"}},