(ctx context.Context, projectName string, imageNameToIdMap map[string]string)
| 718 | } |
| 719 | |
| 720 | func (s *composeService) pruneDanglingImagesOnRebuild(ctx context.Context, projectName string, imageNameToIdMap map[string]string) { |
| 721 | images, err := s.apiClient().ImageList(ctx, client.ImageListOptions{ |
| 722 | Filters: projectFilter(projectName).Add("dangling", "true"), |
| 723 | }) |
| 724 | if err != nil { |
| 725 | logrus.Debugf("Failed to list images: %v", err) |
| 726 | return |
| 727 | } |
| 728 | |
| 729 | for _, img := range images.Items { |
| 730 | if _, ok := imageNameToIdMap[img.ID]; !ok { |
| 731 | _, err := s.apiClient().ImageRemove(ctx, img.ID, client.ImageRemoveOptions{}) |
| 732 | if err != nil { |
| 733 | logrus.Debugf("Failed to remove image %s: %v", img.ID, err) |
| 734 | } |
| 735 | } |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | // Walks develop.watch.path and checks which files should be copied inside the container |
| 740 | // ignores develop.watch.ignore, Dockerfile, compose files, bind mounted paths and .git |
no test coverage detected