Skip to content

Commit

Permalink
Fix dockerfile path with compose cli v2 (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
kierenevans authored Sep 2, 2021
1 parent 60eb2c6 commit 24a8ec1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/_base/harness/config/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ function('docker_service_images', [filterService]): |
}
if (isset($service['build'])) {
$context = rtrim($service['build']['context'], '/');
$dockerfile = $service['build']['dockerfile'] ?? 'Dockerfile';
$dockerfilePath = $service['build']['dockerfile'] ?? 'Dockerfile';
if (substr($dockerfilePath, 0, 1) !== '/') {
$dockerfilePath = rtrim($service['build']['context'], '/') . '/' . $dockerfilePath;
}
if (preg_match_all('/^FROM\s+([^\s]*)/m', file_get_contents($context.'/'.$dockerfile), $matches) === false) {
if (preg_match_all('/^FROM\s+([^\s]*)/m', file_get_contents($dockerfilePath), $matches) === false) {
continue;
}
Expand Down

0 comments on commit 24a8ec1

Please sign in to comment.