Skip to content

Commit

Permalink
Assert on minimum docker-compose version
Browse files Browse the repository at this point in the history
  • Loading branch information
hgraca committed Mar 4, 2020
1 parent 8c5863e commit 757f55d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/lib/docker.php
Expand Up @@ -44,3 +44,13 @@ function isContainerExists(string $containerName): bool

return true;
}

function assertDockerComposeVersion(): void
{
$minimumVersion = '1.22';
$currentVersion = shell_exec("docker-compose version --short");
if ($currentVersion < $minimumVersion) {
echo "The minimum docker-compose version is $minimumVersion \n";
exit(1);
}
}
2 changes: 2 additions & 0 deletions bin/run
Expand Up @@ -11,6 +11,8 @@ declare(strict_types=1);

include_once('lib/docker.php');

assertDockerComposeVersion();

$debug = false;

$env = getenv('ENV') ?: 'dev';
Expand Down
2 changes: 2 additions & 0 deletions bin/stop
Expand Up @@ -5,6 +5,8 @@ declare(strict_types=1);

include_once('lib/docker.php');

assertDockerComposeVersion();

$debug = false;

$env = getenv('ENV') ?: 'dev';
Expand Down

0 comments on commit 757f55d

Please sign in to comment.