@@ -16,25 +16,34 @@ import (
1616 "github.com/livekit/protocol/logger"
1717)
1818
19- var standardTarballExcludeFiles = []string {
20- "Dockerfile" ,
21- ".dockerignore" ,
22- ".gitignore" ,
23- ".git" ,
24- "node_modules" ,
25- "*.env" ,
26- }
19+ var (
20+ defaultExcludePatterns = []string {
21+ "Dockerfile" ,
22+ ".dockerignore" ,
23+ ".gitignore" ,
24+ ".git" ,
25+ "node_modules" ,
26+ "*.env" ,
27+ }
28+
29+ ignoreFilePatterns = []string {
30+ ".gitignore" ,
31+ ".dockerignore" ,
32+ }
33+ )
2734
2835func UploadTarball (directory string , presignedUrl string , excludeFiles []string ) error {
29- excludeFiles = append (standardTarballExcludeFiles , excludeFiles ... )
36+ excludeFiles = append (defaultExcludePatterns , excludeFiles ... )
3037
31- dockerIgnore := filepath .Join (directory , ".dockerignore" )
32- if _ , err := os .Stat (dockerIgnore ); err == nil {
33- content , err := os .ReadFile (dockerIgnore )
34- if err != nil {
35- return fmt .Errorf ("failed to read .dockerignore: %w" , err )
38+ for _ , exclude := range ignoreFilePatterns {
39+ ignore := filepath .Join (directory , exclude )
40+ if _ , err := os .Stat (ignore ); err == nil {
41+ content , err := os .ReadFile (ignore )
42+ if err != nil {
43+ return fmt .Errorf ("failed to read %s: %w" , ignore , err )
44+ }
45+ excludeFiles = append (excludeFiles , strings .Split (string (content ), "\n " )... )
3646 }
37- excludeFiles = append (excludeFiles , strings .Split (string (content ), "\n " )... )
3847 }
3948
4049 for i , exclude := range excludeFiles {
0 commit comments