1
0
mirror of https://github.com/rancher/os.git synced 2025-06-27 15:26:50 +00:00

Godep updates

This commit is contained in:
Darren Shepherd 2015-04-22 14:25:45 -07:00
parent cd78981878
commit b2ece71237
2 changed files with 40 additions and 31 deletions

8
Godeps/Godeps.json generated
View File

@ -221,13 +221,13 @@
},
{
"ImportPath": "github.com/rancherio/rancher-compose/docker",
"Comment": "0.1.0-12-g8fecf18",
"Rev": "8fecf186bdab6b14c9f625f9499f959fd8590482"
"Comment": "0.1.0-13-g0694d95",
"Rev": "0694d95502831b4d22422ff623889cf70bc017e2"
},
{
"ImportPath": "github.com/rancherio/rancher-compose/project",
"Comment": "0.1.0-12-g8fecf18",
"Rev": "8fecf186bdab6b14c9f625f9499f959fd8590482"
"Comment": "0.1.0-13-g0694d95",
"Rev": "0694d95502831b4d22422ff623889cf70bc017e2"
},
{
"ImportPath": "github.com/ryanuber/go-glob",

View File

@ -3,6 +3,7 @@ package docker
import (
"strings"
"github.com/docker/docker/nat"
"github.com/docker/docker/runconfig"
"github.com/rancherio/rancher-compose/project"
@ -17,35 +18,43 @@ func Convert(c *project.ServiceConfig) (*runconfig.Config, *runconfig.HostConfig
cmd, _ := shlex.Split(c.Command)
entrypoint, _ := shlex.Split(c.Entrypoint)
ports, binding, err := nat.ParsePortSpecs(c.Ports)
return &runconfig.Config{
Entrypoint: entrypoint,
Hostname: c.Hostname,
Domainname: c.DomainName,
User: c.User,
Memory: c.MemLimit,
CpuShares: c.CpuShares,
Env: c.Environment,
Cmd: cmd,
Image: c.Image,
Labels: kvListToMap(c.Labels),
if err != nil {
return nil, nil, err
}
config := &runconfig.Config{
Entrypoint: entrypoint,
Hostname: c.Hostname,
Domainname: c.DomainName,
User: c.User,
Memory: c.MemLimit,
CpuShares: c.CpuShares,
Env: c.Environment,
Cmd: cmd,
Image: c.Image,
Labels: kvListToMap(c.Labels),
ExposedPorts: ports,
}
host_config := &runconfig.HostConfig{
VolumesFrom: c.VolumesFrom,
CapAdd: c.CapAdd,
CapDrop: c.CapDrop,
Privileged: c.Privileged,
Binds: c.Volumes,
Dns: c.Dns,
LogConfig: runconfig.LogConfig{
Type: c.LogDriver,
},
&runconfig.HostConfig{
VolumesFrom: c.VolumesFrom,
CapAdd: c.CapAdd,
CapDrop: c.CapDrop,
Privileged: c.Privileged,
Binds: c.Volumes,
Dns: c.Dns,
LogConfig: runconfig.LogConfig{
Type: c.LogDriver,
},
NetworkMode: runconfig.NetworkMode(c.Net),
ReadonlyRootfs: c.ReadOnly,
PidMode: runconfig.PidMode(c.Pid),
IpcMode: runconfig.IpcMode(c.Ipc),
},
nil
NetworkMode: runconfig.NetworkMode(c.Net),
ReadonlyRootfs: c.ReadOnly,
PidMode: runconfig.PidMode(c.Pid),
IpcMode: runconfig.IpcMode(c.Ipc),
PortBindings: binding,
}
return config, host_config, nil
}
func kvListToMap(list []string) map[string]string {