Skip to content

Commit 24d2807

Browse files
committed
init: add .dockerignore to sync ignore if exists
1 parent aa96cb6 commit 24d2807

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

cmd/init.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,15 @@ func (cmd *InitCmd) addDevConfig(config *latest.Config, imageName, image string,
669669
devConfig.Sync = []*latest.SyncConfig{}
670670
}
671671

672-
devConfig.Sync = append(devConfig.Sync, &latest.SyncConfig{
672+
syncConfig := &latest.SyncConfig{
673673
Path: "./",
674-
})
674+
}
675+
676+
if _, err := os.Stat(".dockerignore"); err == nil {
677+
syncConfig.UploadExcludeFile = ".dockerignore"
678+
}
679+
680+
devConfig.Sync = append(devConfig.Sync, syncConfig)
675681

676682
devConfig.Terminal = &latest.Terminal{
677683
Command: "./" + startScriptName,

0 commit comments

Comments
 (0)