Skip to content

Commit

Permalink
Merge pull request #345 from mc256/env_file
Browse files Browse the repository at this point in the history
Add env-file option to the optimize command
  • Loading branch information
ktock authored Jun 25, 2021
2 parents cb69e8d + 098f29e commit b10e770
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/ctr-remote/commands/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ var samplerFlags = []cli.Flag{
Name: "env",
Usage: "environment valulable to add or override to the image's default config",
},
cli.StringFlag{
Name: "env-file",
Usage: "specify additional container environment variables in a file(i.e. FOO=bar, one per line)",
},
cli.StringSliceFlag{
Name: "mount",
Usage: "additional mounts for the container (e.g. type=foo,source=/path,destination=/target,options=bind)",
Expand Down Expand Up @@ -162,6 +166,9 @@ func getSpecOpts(clicontext *cli.Context) func(image containerd.Image, rootfs st
resolverOpt,
entrypointOpt,
)
if envFile := clicontext.String("env-file"); envFile != "" {
opts = append(opts, oci.WithEnvFile(envFile))
}
if username := clicontext.String("user"); username != "" {
opts = append(opts, oci.WithUser(username))
}
Expand Down

0 comments on commit b10e770

Please sign in to comment.