diff --git a/ProcessMaker/Console/Commands/BuildScriptExecutors.php b/ProcessMaker/Console/Commands/BuildScriptExecutors.php index d2bf0edca5..07bb9b40eb 100644 --- a/ProcessMaker/Console/Commands/BuildScriptExecutors.php +++ b/ProcessMaker/Console/Commands/BuildScriptExecutors.php @@ -5,6 +5,7 @@ use Exception; use Illuminate\Console\Command; use ProcessMaker\Events\BuildScriptExecutor; +use ProcessMaker\Exception\InvalidDockerImageException; use ProcessMaker\Facades\Docker; use ProcessMaker\Models\ScriptExecutor; @@ -71,7 +72,7 @@ public function handle() $this->userId = $this->argument('user'); try { $this->buildExecutor(); - } catch (\Exception $e) { + } catch (Exception $e) { if ($this->userId) { event(new BuildScriptExecutor($e->getMessage(), $this->userId, 'error')); } @@ -153,7 +154,8 @@ public function buildExecutor() $this->info('Building the docker executor'); $image = $scriptExecutor->dockerImageName(); - $command = Docker::command() . " build --build-arg SDK_DIR=/sdk -t {$image} -f {$packagePath}/Dockerfile.custom {$packagePath}"; + $command = Docker::command() . + " build --build-arg SDK_DIR=./sdk -t {$image} -f {$packagePath}/Dockerfile.custom {$packagePath}"; if ($this->userId) { $this->runProc( @@ -229,7 +231,7 @@ private function associateWithExistingImage($executor) $instance = config('app.instance'); foreach ($images as $image) { if (!preg_match('/executor-' . $instance . '-.+-(\d+):/', $image, $match)) { - throw new \Exception('Not a valid image:' . (string) $image); + throw new InvalidDockerImageException('Not a valid image:' . (string) $image); } $id = intval($match[1]); $existingExecutor = ScriptExecutor::find($id); diff --git a/ProcessMaker/Exception/InvalidDockerImageException.php b/ProcessMaker/Exception/InvalidDockerImageException.php new file mode 100644 index 0000000000..fd4abad0eb --- /dev/null +++ b/ProcessMaker/Exception/InvalidDockerImageException.php @@ -0,0 +1,13 @@ +