Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bug-12236/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ignore everything by default
*
# add exceptions here
!dir1/
3 changes: 3 additions & 0 deletions bug-12236/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM alpine:latest
WORKDIR /app
ENTRYPOINT ["ls", "-la"]
11 changes: 11 additions & 0 deletions bug-12236/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
alpine:
build:
context: .
dockerfile: Dockerfile
develop:
watch:
- action: sync+restart
x-initialSync: true
path: ./dir1
target: /app/dir1
Empty file added bug-12236/dir1/foo.txt
Empty file.
4 changes: 3 additions & 1 deletion pkg/compose/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func (s *composeService) initialSync(ctx context.Context, project *types.Project
if err != nil {
return err
}

logrus.Debugf("copying %d files for initial sync", len(pathsToCopy))
return syncer.Sync(ctx, service, pathsToCopy)
}

Expand Down Expand Up @@ -651,6 +651,7 @@ func (s *composeService) initialSyncFiles(ctx context.Context, project *types.Pr
return nil
}
if shouldIgnore(filepath.Base(path), ignore) || checkIfPathAlreadyBindMounted(path, service.Volumes) {
logrus.Debugf("ignoring file %s", path)
// By definition sync ignores bind mounted paths
if d.IsDir() {
// skip folder
Expand All @@ -665,6 +666,7 @@ func (s *composeService) initialSyncFiles(ctx context.Context, project *types.Pr
if !d.IsDir() {
if info.ModTime().Before(timeImageCreated) {
// skip file if it was modified before image creation
logrus.Debugf("skipping file %s; it was modified before image creation", path)
return nil
}
rel, err := filepath.Rel(trigger.Path, path)
Expand Down
4 changes: 3 additions & 1 deletion pkg/watch/dockerignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"path/filepath"
"strings"

"github.com/sirupsen/logrus"

"github.com/compose-spec/compose-go/v2/types"
"github.com/docker/compose/v2/internal/paths"
"github.com/moby/patternmatcher"
Expand Down Expand Up @@ -83,7 +85,7 @@ func LoadDockerIgnore(build *types.BuildConfig) (*dockerPathMatcher, error) {
return nil, err
}
defer func() { _ = f.Close() }()

logrus.Debugf("Using .dockerignore file: %s", f.Name())
patterns, err := readDockerignorePatterns(f)
if err != nil {
return nil, err
Expand Down