Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using custom ARM-based Docker images #219

Merged
merged 4 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/BuildProcess/BuildContainerImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,13 @@ public function validateDockerFile($environment, $runtime, $buildArgs)
{
$contents = file_get_contents(Path::dockerfile($environment));

if ($runtime === 'docker' && ! Str::contains($contents, 'FROM laravelphp/vapor')) {
Helpers::warn('To ensure compatibility with the "docker" runtime, please make sure that your image is correctly configured for the x86 architecture.');
if (in_array($runtime, ['docker', 'docker-arm']) && ! Str::contains($contents, 'FROM laravelphp/vapor')) {
$arch = $runtime === 'docker' ? 'x86' : 'ARM';
Helpers::warn("To ensure compatibility with the \"{$runtime}\" runtime, please make sure that your image is correctly configured for the {$arch} architecture.");

return true;
}

if (! Str::contains($contents, 'FROM laravelphp/vapor')) {
return false;
}

foreach ($buildArgs as $key => $value) {
$contents = str_replace('${'.$key.'}', $value, $contents);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/BuildContainerImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function runtimeProvider()
'docker-arm',
'FROM custom/image',
[],
false,
true,
],
[
'docker',
Expand Down Expand Up @@ -150,7 +150,7 @@ public function runtimeProvider()
'docker-arm',
'FROM custom/vapor:php82',
[],
false,
true,
],

// End of line tests...
Expand Down