Skip to content

Commit c43e157

Browse files
committed
introduce dockerfile_inline
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 02f25ec commit c43e157

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

loader/normalize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func Normalize(project *types.Project, resolvePaths bool) error {
7272
}
7373

7474
if s.Build != nil {
75-
if s.Build.Dockerfile == "" {
75+
if s.Build.Dockerfile == "" && s.Build.DockerfileInline == "" {
7676
s.Build.Dockerfile = "Dockerfile"
7777
}
7878
localContext := absPath(project.WorkingDir, s.Build.Context)

loader/validate.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ func checkConsistency(project *types.Project) error {
3232
return errors.Wrapf(errdefs.ErrInvalid, "service %q has neither an image nor a build context specified", s.Name)
3333
}
3434

35+
if s.Build != nil {
36+
if s.Build.DockerfileInline != "" && s.Build.Dockerfile != "" {
37+
return errors.Wrapf(errdefs.ErrInvalid, "service %q declares mutualy exclusive dockerfile and dockerfile_inline", s.Name)
38+
}
39+
}
40+
3541
for network := range s.Networks {
3642
if _, ok := project.Networks[network]; !ok {
3743
return errors.Wrap(errdefs.ErrInvalid, fmt.Sprintf("service %q refers to undefined network %s", s.Name, network))

schema/compose-spec.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
"properties": {
9292
"context": {"type": "string"},
9393
"dockerfile": {"type": "string"},
94+
"dockerfile_inline": {"type": "string"},
9495
"args": {"$ref": "#/definitions/list_or_dict"},
9596
"ssh": {"$ref": "#/definitions/list_or_dict"},
9697
"labels": {"$ref": "#/definitions/list_or_dict"},

types/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ func (s set) toSlice() []string {
296296
type BuildConfig struct {
297297
Context string `yaml:",omitempty" json:"context,omitempty"`
298298
Dockerfile string `yaml:",omitempty" json:"dockerfile,omitempty"`
299+
DockerfileInline string `yaml:",omitempty" json:"dockerfile_inline,omitempty"`
299300
Args MappingWithEquals `yaml:",omitempty" json:"args,omitempty"`
300301
SSH SSHConfig `yaml:"ssh,omitempty" json:"ssh,omitempty"`
301302
Labels Labels `yaml:",omitempty" json:"labels,omitempty"`

0 commit comments

Comments
 (0)