docker-compose - fix Command and add Entrypoint support

This commit is contained in:
Tomas Kral 2016-08-29 19:58:32 +02:00
parent 0da484a974
commit 8590a98504
No known key found for this signature in database
GPG Key ID: E690DA7E4F291FA6
4 changed files with 5 additions and 16 deletions

View File

@ -35,7 +35,6 @@ var unsupportedKey = map[string]int{
"DNS": 0,
"DNSSearch": 0,
"DomainName": 0,
"Entrypoint": 0,
"EnvFile": 0,
"Expose": 0,
"Extends": 0,

View File

@ -119,6 +119,7 @@ func (c *Compose) LoadFile(file string) kobject.KomposeObject {
// load compose file into composeObject
composeObject := project.NewProject(&context.Context, nil, nil)
err := composeObject.Parse()
if err != nil {
logrus.Fatalf("Failed to load compose file: %v", err)
@ -150,6 +151,8 @@ func (c *Compose) LoadFile(file string) kobject.KomposeObject {
serviceConfig := kobject.ServiceConfig{}
serviceConfig.Image = composeServiceConfig.Image
serviceConfig.ContainerName = composeServiceConfig.ContainerName
serviceConfig.Entrypoint = composeServiceConfig.Entrypoint
serviceConfig.Command = composeServiceConfig.Command
// load environment variables
envs := loadEnvVars(composeServiceConfig.Environment.ToMap())

View File

@ -243,9 +243,6 @@ func UpdateKubernetesObjects(name string, service kobject.ServiceConfig, objects
// Configure the environment variables.
envs := ConfigEnvs(name, service)
// Configure the container command.
cmds := transformer.ConfigCommands(service)
// Configure the container volumes.
volumesMount, volumes := ConfigVolumes(service)
@ -261,8 +258,8 @@ func UpdateKubernetesObjects(name string, service kobject.ServiceConfig, objects
template.Spec.Containers[0].Name = service.ContainerName
}
template.Spec.Containers[0].Env = envs
template.Spec.Containers[0].Command = cmds
template.Spec.Containers[0].Args = service.Args
template.Spec.Containers[0].Command = service.Entrypoint
template.Spec.Containers[0].Args = service.Command
template.Spec.Containers[0].WorkingDir = service.WorkingDir
template.Spec.Containers[0].VolumeMounts = volumesMount
template.Spec.Volumes = volumes

View File

@ -41,16 +41,6 @@ func CreateOutFile(out string) *os.File {
return f
}
// Configure the container commands
func ConfigCommands(service kobject.ServiceConfig) []string {
var cmds []string
for _, cmd := range service.Command {
cmds = append(cmds, cmd)
}
return cmds
}
// parseVolume parse a given volume, which might be [name:][host:]container[:access_mode]
func ParseVolume(volume string) (name, host, container, mode string, err error) {
separator := ":"