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

fix: write an empty Procfile to force detection to work for all buildpacks

Some buildpack groups fail to detect because of a missing Procfile, such as the heroku/python buildpack.
Jose Diaz-Gonzalez 2 лет назад
Родитель
Сommit
c273e49879
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      cli/cmd/pack/pack.go

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

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