Commit f349c5cd authored by Jürgen Haas's avatar Jürgen Haas
Browse files

l3d#37 Add phpstan script which runs in its own docker container

parent f4f79991
Pipeline #12152 passed with stage
in 50 seconds
#!/bin/bash
export $(cat .env | xargs)
docker run --rm -v $(php /usr/local/bin/volume.php /app) phpstan/phpstan "$@"
......@@ -16,15 +16,17 @@ function readContainerConfig() {
return [];
}
function getDockerMountSource() {
function getDockerMountSource($args) {
$currentDir = getcwd();
$destDir = (empty($args[1])) ? $currentDir : $args[1];
$container = readContainerConfig();
foreach ($container['Mounts'] as $mount) {
if (strpos($currentDir, $mount['Destination']) === 0) {
return $mount['Source'] . ':' . $mount['Destination'];
return $mount['Source'] . ':' . (empty($args[1]) ? $mount['Destination'] : $destDir);
}
}
return $currentDir . ':' . $currentDir;
return $currentDir . ':' . $destDir;
}
print(getDockerMountSource());
print(getDockerMountSource($argv));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment