@@ -539,25 +539,25 @@ def file_path(filename):
539539 return os .path .join (image .application .subdirectory , filename )
540540 return filename
541541
542+ dockerfile_candidates = ["Dockerfile.cabotage" , "Dockerfile" ]
543+ if image .application .dockerfile_path :
544+ dockerfile_candidates = [image .application .dockerfile_path ]
545+
542546 dockerfile_name = None
543- dockerfile_body = _fetch_github_file (
544- image .application .github_repository ,
545- image .commit_sha ,
546- access_token = access_token ,
547- filename = file_path ("Dockerfile.cabotage" ),
548- )
549- dockerfile_name = "Dockerfile.cabotage"
550- if dockerfile_body is None :
547+ dockerfile_body = None
548+ for candidate in dockerfile_candidates :
551549 dockerfile_body = _fetch_github_file (
552550 image .application .github_repository ,
553551 image .commit_sha ,
554552 access_token = access_token ,
555- filename = file_path ("Dockerfile" ),
553+ filename = file_path (candidate ),
556554 )
557- dockerfile_name = "Dockerfile"
555+ if dockerfile_body is not None :
556+ dockerfile_name = candidate
557+ break
558558 if dockerfile_body is None :
559559 raise BuildError (
560- "No Dockerfile.cabotage or Dockerfile found in root of "
560+ f "No Dockerfile found in "
561561 f"{ git_ref (image .application .github_repository , image .commit_sha )} "
562562 )
563563
0 commit comments