mirror of https://github.com/docker/cli.git
Merge pull request #481 from cdrage/add-build-to-service-config
Add 'build' to types.go
This commit is contained in:
commit
2eb31e6b60
|
@ -2,6 +2,21 @@ version: "3.4"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
foo:
|
foo:
|
||||||
|
|
||||||
|
build:
|
||||||
|
context: ./dir
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
foo: bar
|
||||||
|
target: foo
|
||||||
|
network: foo
|
||||||
|
cache_from:
|
||||||
|
- foo
|
||||||
|
- bar
|
||||||
|
labels: [FOO=BAR]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cap_add:
|
cap_add:
|
||||||
- ALL
|
- ALL
|
||||||
|
|
||||||
|
|
|
@ -517,12 +517,14 @@ version: "3"
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
image: web
|
image: web
|
||||||
build: ./web
|
build:
|
||||||
|
context: ./web
|
||||||
links:
|
links:
|
||||||
- bar
|
- bar
|
||||||
db:
|
db:
|
||||||
image: db
|
image: db
|
||||||
build: ./db
|
build:
|
||||||
|
context: ./db
|
||||||
`))
|
`))
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
@ -686,6 +688,15 @@ func TestFullExample(t *testing.T) {
|
||||||
expectedServiceConfig := types.ServiceConfig{
|
expectedServiceConfig := types.ServiceConfig{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
|
|
||||||
|
Build: types.BuildConfig{
|
||||||
|
Context: "./dir",
|
||||||
|
Dockerfile: "Dockerfile",
|
||||||
|
Args: map[string]*string{"foo": strPtr("bar")},
|
||||||
|
Target: "foo",
|
||||||
|
Network: "foo",
|
||||||
|
CacheFrom: []string{"foo", "bar"},
|
||||||
|
Labels: map[string]string{"FOO": "BAR"},
|
||||||
|
},
|
||||||
CapAdd: []string{"ALL"},
|
CapAdd: []string{"ALL"},
|
||||||
CapDrop: []string{"NET_ADMIN", "SYS_ADMIN"},
|
CapDrop: []string{"NET_ADMIN", "SYS_ADMIN"},
|
||||||
CgroupParent: "m-executor-abcd",
|
CgroupParent: "m-executor-abcd",
|
||||||
|
|
|
@ -79,6 +79,7 @@ type Config struct {
|
||||||
type ServiceConfig struct {
|
type ServiceConfig struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Build BuildConfig
|
||||||
CapAdd []string `mapstructure:"cap_add"`
|
CapAdd []string `mapstructure:"cap_add"`
|
||||||
CapDrop []string `mapstructure:"cap_drop"`
|
CapDrop []string `mapstructure:"cap_drop"`
|
||||||
CgroupParent string `mapstructure:"cgroup_parent"`
|
CgroupParent string `mapstructure:"cgroup_parent"`
|
||||||
|
@ -126,6 +127,18 @@ type ServiceConfig struct {
|
||||||
WorkingDir string `mapstructure:"working_dir"`
|
WorkingDir string `mapstructure:"working_dir"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BuildConfig is a type for build
|
||||||
|
// using the same format at libcompose: https://github.com/docker/libcompose/blob/master/yaml/build.go#L12
|
||||||
|
type BuildConfig struct {
|
||||||
|
Context string
|
||||||
|
Dockerfile string
|
||||||
|
Args MappingWithEquals
|
||||||
|
Labels Labels
|
||||||
|
CacheFrom StringList `mapstructure:"cache_from"`
|
||||||
|
Network string
|
||||||
|
Target string
|
||||||
|
}
|
||||||
|
|
||||||
// ShellCommand is a string or list of string args
|
// ShellCommand is a string or list of string args
|
||||||
type ShellCommand []string
|
type ShellCommand []string
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue