Skip to content

Commit 882507f

Browse files
authored
Merge pull request #365 from ndeloof/dockerfile-inline
2 parents 507df25 + c43e157 commit 882507f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-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))

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)