add komposeObject struct, remove factory, refactor cli/app

This commit is contained in:
ngtuna
2016-07-19 23:07:28 +07:00
parent 3164cd8abb
commit 7a41edb65e
5 changed files with 544 additions and 519 deletions
+452 -437
View File
File diff suppressed because it is too large Load Diff
+52 -8
View File
@@ -16,13 +16,57 @@ limitations under the License.
package app
import (
"github.com/urfave/cli"
"github.com/docker/libcompose/project"
)
//
//// ProjectFactory is an interface that helps creating libcompose project.
//type ProjectFactory interface {
// // Create creates a libcompose project from the command line options (codegangsta cli context).
// Create(c *cli.Context) (*project.Project, error)
//}
// ProjectFactory is an interface that helps creating libcompose project.
type ProjectFactory interface {
// Create creates a libcompose project from the command line options (codegangsta cli context).
Create(c *cli.Context) (*project.Project, error)
type KomposeObject struct {
ServiceConfigs map[string]ServiceConfig
}
type ServiceConfig struct {
ContainerName string
Image string
Environment []EnvVar
Port []Ports
Command []string
WorkingDir string
Args []string
//Volume []Volumes
Network []string
Labels map[string]string
CPUSet string
CPUShares int64
CPUQuota int64
CapAdd []string
CapDrop []string
Entrypoint []string
Expose []string
Privileged bool
Restart string
User string
}
type EnvVar struct {
Name string
Value string
}
type Ports struct {
HostPort int32
ContainerPort int32
Protocol Protocol
}
// Protocol defines network protocols supported for things like container ports.
type Protocol string
const (
// ProtocolTCP is the TCP protocol.
ProtocolTCP Protocol = "TCP"
// ProtocolUDP is the UDP protocol.
ProtocolUDP Protocol = "UDP"
)