Просмотр исходного кода

fix: write an empty Procfile to force detection to work for all buildpacks (#3692)

jose-fully-ported 2 лет назад
Родитель
Сommit
fefb747a7a
1 измененных файлов с 11 добавлено и 0 удалено
  1. 11 0
      cli/cmd/pack/pack.go

+ 11 - 0
cli/cmd/pack/pack.go

@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"io/ioutil"
 	"net/url"
+	"os"
 	"path/filepath"
 	"regexp"
 	"strings"
@@ -41,6 +42,16 @@ func (a *Agent) Build(ctx context.Context, opts *docker.BuildOpts, buildConfig *
 		return err
 	}
 
+	mode := os.FileMode(0o600)
+	procfilePath := filepath.Clean(filepath.Join(absPath, "Procfile"))
+	file, err := os.OpenFile(procfilePath, os.O_RDONLY|os.O_CREATE, mode)
+	if err != nil {
+		return err
+	}
+	if err := file.Close(); err != nil {
+		return err
+	}
+
 	buildOpts := packclient.BuildOptions{
 		RelativeBaseDir: filepath.Dir(absPath),
 		Image:           fmt.Sprintf("%s:%s", opts.ImageRepo, opts.Tag),