MCPcopy
hub / github.com/docker/compose / initialSync

Method initialSync

pkg/compose/watch.go:741–769  ·  pkg/compose/watch.go::composeService.initialSync

Walks develop.watch.path and checks which files should be copied inside the container ignores develop.watch.ignore, Dockerfile, compose files, bind mounted paths and .git

(ctx context.Context, project *types.Project, service types.ServiceConfig, trigger types.Trigger, syncer sync.Syncer)

Source from the content-addressed store, hash-verified

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
741func (s *composeService) initialSync(ctx context.Context, project *types.Project, service types.ServiceConfig, trigger types.Trigger, syncer sync.Syncer) error {
742 dockerIgnores, err := watch.LoadDockerIgnore(service.Build)
743 if err != nil {
744 return err
745 }
746
747 dotGitIgnore, err := watch.NewDockerPatternMatcher("/", []string{".git/"})
748 if err != nil {
749 return err
750 }
751
752 triggerIgnore, err := watch.NewDockerPatternMatcher(trigger.Path, trigger.Ignore)
753 if err != nil {
754 return err
755 }
756 // FIXME .dockerignore
757 ignoreInitialSync := watch.NewCompositeMatcher(
758 dockerIgnores,
759 watch.EphemeralPathMatcher(),
760 dotGitIgnore,
761 triggerIgnore)
762
763 pathsToCopy, err := s.initialSyncFiles(ctx, project, service, trigger, ignoreInitialSync)
764 if err != nil {
765 return err
766 }
767
768 return syncer.Sync(ctx, service.Name, pathsToCopy)
769}
770
771// Syncs files from develop.watch.path if they have been modified after the image has been created
772//

Callers 1

watchMethod · 0.95

Calls 6

initialSyncFilesMethod · 0.95
LoadDockerIgnoreFunction · 0.92
NewDockerPatternMatcherFunction · 0.92
NewCompositeMatcherFunction · 0.92
EphemeralPathMatcherFunction · 0.92
SyncMethod · 0.65

Tested by

no test coverage detected