mirror of
https://github.com/containers/podman.git
synced 2025-05-21 17:16:22 +08:00
Merge pull request #12092 from rhatdan/build
If Dockerfile exists in same directory as service, we should not use it.
This commit is contained in:
@ -151,22 +151,19 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
|||||||
var m = []string{}
|
var m = []string{}
|
||||||
if err := json.Unmarshal([]byte(query.Dockerfile), &m); err != nil {
|
if err := json.Unmarshal([]byte(query.Dockerfile), &m); err != nil {
|
||||||
// it's not json, assume just a string
|
// it's not json, assume just a string
|
||||||
m = append(m, query.Dockerfile)
|
m = []string{filepath.Join(contextDirectory, query.Dockerfile)}
|
||||||
}
|
}
|
||||||
containerFiles = m
|
containerFiles = m
|
||||||
} else {
|
} else {
|
||||||
containerFiles = []string{"Dockerfile"}
|
containerFiles = []string{filepath.Join(contextDirectory, "Dockerfile")}
|
||||||
if utils.IsLibpodRequest(r) {
|
if utils.IsLibpodRequest(r) {
|
||||||
containerFiles = []string{"Containerfile"}
|
containerFiles = []string{filepath.Join(contextDirectory, "Containerfile")}
|
||||||
if _, err = os.Stat(filepath.Join(contextDirectory, "Containerfile")); err != nil {
|
if _, err = os.Stat(containerFiles[0]); err != nil {
|
||||||
if _, err1 := os.Stat(filepath.Join(contextDirectory, "Dockerfile")); err1 == nil {
|
containerFiles = []string{filepath.Join(contextDirectory, "Dockerfile")}
|
||||||
containerFiles = []string{"Dockerfile"}
|
if _, err1 := os.Stat(containerFiles[0]); err1 != nil {
|
||||||
} else {
|
|
||||||
utils.BadRequest(w, "dockerfile", query.Dockerfile, err)
|
utils.BadRequest(w, "dockerfile", query.Dockerfile, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
containerFiles = []string{"Dockerfile"}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user