فهرست منبع

Merge pull request #3098 from infosiftr/arch-docker-from

Add a separate ArchDockerFrom function for better template granularity
yosifkit 8 سال پیش
والد
کامیت
03b19d6857
3فایلهای تغییر یافته به همراه8 افزوده شده و 3 حذف شده
  1. 1 1
      bashbrew/go/src/bashbrew/cmd-build.go
  2. 6 1
      bashbrew/go/src/bashbrew/docker.go
  3. 1 1
      bashbrew/go/src/bashbrew/git.go

+ 1 - 1
bashbrew/go/src/bashbrew/cmd-build.go

@@ -76,7 +76,7 @@ func cmdBuild(c *cli.Context) error {
 			if err != nil {
 				fmt.Printf("Building %s (%s)\n", cacheTag, r.EntryIdentifier(entry))
 
-				commit, err := r.fetchGitRepo(&entry)
+				commit, err := r.fetchGitRepo(arch, &entry)
 				if err != nil {
 					return cli.NewMultiError(fmt.Errorf(`failed fetching git repo for %q (tags %q)`, r.RepoName, entry.TagsString()), err)
 				}

+ 6 - 1
bashbrew/go/src/bashbrew/docker.go

@@ -19,7 +19,11 @@ import (
 var dockerFromCache = map[string]string{}
 
 func (r Repo) DockerFrom(entry *manifest.Manifest2822Entry) (string, error) {
-	commit, err := r.fetchGitRepo(entry)
+	return r.ArchDockerFrom(arch, entry)
+}
+
+func (r Repo) ArchDockerFrom(arch string, entry *manifest.Manifest2822Entry) (string, error) {
+	commit, err := r.fetchGitRepo(arch, entry)
 	if err != nil {
 		return "", err
 	}
@@ -56,6 +60,7 @@ func (r Repo) DockerFrom(entry *manifest.Manifest2822Entry) (string, error) {
 	return from, nil
 }
 
+// TODO determine multi-stage-builds impact here (once official images are willing/able to support them; post-17.06 at the earliest)
 func dockerfileFrom(dockerfile io.Reader) (string, error) {
 	scanner := bufio.NewScanner(dockerfile)
 	for scanner.Scan() {

+ 1 - 1
bashbrew/go/src/bashbrew/git.go

@@ -103,7 +103,7 @@ func gitNormalizeForTagUsage(text string) string {
 
 var gitRepoCache = map[string]string{}
 
-func (r Repo) fetchGitRepo(entry *manifest.Manifest2822Entry) (string, error) {
+func (r Repo) fetchGitRepo(arch string, entry *manifest.Manifest2822Entry) (string, error) {
 	cacheKey := strings.Join([]string{
 		entry.ArchGitRepo(arch),
 		entry.ArchGitFetch(arch),