Skip to content

Commit 0d0962d

Browse files
authored
Merge pull request #368 from ndeloof/check_platforms
2 parents e2df0ed + a5f1d1a commit 0d0962d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

loader/validate.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ func checkConsistency(project *types.Project) error {
3636
if s.Build.DockerfileInline != "" && s.Build.Dockerfile != "" {
3737
return errors.Wrapf(errdefs.ErrInvalid, "service %q declares mutualy exclusive dockerfile and dockerfile_inline", s.Name)
3838
}
39+
40+
if len(s.Build.Platforms) > 0 && s.Platform != "" {
41+
var found bool
42+
for _, platform := range s.Build.Platforms {
43+
if platform == s.Platform {
44+
found = true
45+
break
46+
}
47+
}
48+
if !found {
49+
return errors.Wrapf(errdefs.ErrInvalid, "service.build.platforms MUST include service.platform %q ", s.Platform)
50+
}
51+
}
3952
}
4053

4154
for network := range s.Networks {

0 commit comments

Comments
 (0)