add edits from review

Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
This commit is contained in:
Sergei Biriukov
2023-05-01 16:41:29 +10:00
committed by Muayyad Alsadi
parent d1f5ac9edc
commit 57c527c2c9
2 changed files with 58 additions and 25 deletions

View File

@ -24,7 +24,6 @@ import json
import glob
from threading import Thread
from pathlib import Path
import shlex
@ -1302,10 +1301,12 @@ def normalize_service_final(service: dict, project_dir: str) -> dict:
if "build" in service:
build = service["build"]
context = build if is_str(build) else build.get("context", ".")
context = str((Path(project_dir) / context).resolve())
dockerfile = "Dockerfile"
if "dockerfile" in service["build"]:
dockerfile = service["build"]["dockerfile"]
context = os.path.normpath(os.path.join(project_dir, context))
dockerfile = (
"Dockerfile"
if is_str(build)
else service["build"].get("dockerfile", "Dockerfile")
)
if not is_dict(service["build"]):
service["build"] = {}
service["build"]["dockerfile"] = dockerfile