Skip to content

Commit

Permalink
fix!: remove cpu/memory options from Docker
Browse files Browse the repository at this point in the history
these options are not normally exposed to processes and are likely
ignored, so the options should be removed to avoid confusion.
  • Loading branch information
justenwalker committed Mar 31, 2021
1 parent 2e40ccb commit db80159
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
26 changes: 0 additions & 26 deletions gw/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ type Options struct {
EntryPoint string
// Command is the list of command arguments to pass to the container
Command []string
// Cpu is the amount of cpu to limit the container
Cpu string
// Memory is the amount of memory to limit the container
Memory string
// Env contains additional environment variables to set
Env map[string]string
// EnvFile loads the given file with the list of environment variables and values
Expand Down Expand Up @@ -103,28 +99,6 @@ func (o commandOption) Apply(spec *Options) {
spec.Command = o
}

// CPU sets the cpu shares
func CPU(cpu string) Option {
return cpuOption(cpu)
}

type cpuOption string

func (o cpuOption) Apply(spec *Options) {
spec.Cpu = string(o)
}

// Memory sets the maximum memory the container may use
func Memory(mem string) Option {
return memoryOption(mem)
}

type memoryOption string

func (o memoryOption) Apply(spec *Options) {
spec.Memory = string(o)
}

// Env sets an environment variable in the container
func Env(key string, value string) Option {
return envOption{key: key, value: value}
Expand Down
2 changes: 0 additions & 2 deletions gw/docker/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ func (c *Service) RunContainer(ctx context.Context, image string, opts ...Option
WorkDir: options.WorkDir,
EntryPoint: options.EntryPoint,
Command: options.Command,
Cpu: options.Cpu,
Memory: options.Memory,
Env: options.Env,
EnvFile: options.EnvFile,
Labels: options.Labels,
Expand Down

0 comments on commit db80159

Please sign in to comment.