BUG: Fixed an issue with Docker build references for older versions
This commit is contained in:
@@ -125,12 +125,25 @@ func getParsedTarMemory(fs billy.Filesystem, tw *tar.Writer, baseDir, extra stri
|
||||
return err
|
||||
}
|
||||
|
||||
log.Printf("FILENAME: %s", filename)
|
||||
readFile, err := ioutil.ReadAll(fileReader)
|
||||
if err != nil {
|
||||
log.Printf("Not file: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
// Fixes issues with older versions of Docker for file format
|
||||
if filename == "Dockerfile" {
|
||||
log.Printf("Should search and replace in readfile.")
|
||||
|
||||
referenceCheck := "FROM frikky/shuffle:"
|
||||
if strings.Contains(string(readFile), referenceCheck) {
|
||||
log.Printf("SHOULD SEARCH & REPLACE!")
|
||||
newReference := fmt.Sprintf("FROM registry.hub.docker.com/frikky/shuffle:")
|
||||
readFile = []byte(strings.Replace(string(readFile), referenceCheck, newReference, -1))
|
||||
}
|
||||
}
|
||||
|
||||
//log.Printf("Filename: %s", filename)
|
||||
// FIXME - might need the folder from EXTRA here
|
||||
// Name has to be e.g. just "requirements.txt"
|
||||
@@ -156,6 +169,21 @@ func getParsedTarMemory(fs billy.Filesystem, tw *tar.Writer, baseDir, extra stri
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
// Fixes App SDK issues.. meh
|
||||
func fixTags(tags []string) []string {
|
||||
checkTag := "frikky/shuffle"
|
||||
newTags := []string{}
|
||||
for _, tag := range tags {
|
||||
if strings.HasPrefix(tag, checkTags) {
|
||||
newTags.append(newTags, fmt.Sprintf("registry.hub.docker.com/%s", tag))
|
||||
}
|
||||
|
||||
newTags.append(tag)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Custom Docker image builder wrapper in memory
|
||||
func buildImageMemory(fs billy.Filesystem, tags []string, dockerfileFolder string) error {
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -5541,6 +5541,8 @@ func iterateAppGithubFolders(fs billy.Filesystem, dir []os.FileInfo, extra strin
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("HANDLING DOCKER FILEREADER - SEARCH&REPLACE?")
|
||||
|
||||
appfileData, err := ioutil.ReadAll(fileReader)
|
||||
if err != nil {
|
||||
log.Printf("Failed reading %s: %s", fullPath, err)
|
||||
|
||||
Reference in New Issue
Block a user