1
0
Эх сурвалжийг харах

If compose file has a build section and no image name, build image with the right derived image name (project_service), like docker-compose.
See awesome_compose/react-express-mongodb example

Signed-off-by: Guillaume Tardif <[email protected]>

Guillaume Tardif 5 жил өмнө
parent
commit
7b1a602fd4
1 өөрчлөгдсөн 5 нэмэгдсэн , 1 устгасан
  1. 5 1
      local/build.go

+ 5 - 1
local/build.go

@@ -52,7 +52,11 @@ func (s *composeService) ensureImagesExists(ctx context.Context, project *types.
 			}
 		}
 		if service.Build != nil {
-			opts[service.Name] = s.toBuildOptions(service, project.WorkingDir)
+			imageName := service.Image
+			if imageName == "" {
+				imageName = project.Name + "_" + service.Name
+			}
+			opts[imageName] = s.toBuildOptions(service, project.WorkingDir)
 			continue
 		}