-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerExecutorPhpServiceProvider.php
More file actions
55 lines (46 loc) · 1.87 KB
/
DockerExecutorPhpServiceProvider.php
File metadata and controls
55 lines (46 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace ProcessMaker\Package\DockerExecutorPhp;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use ProcessMaker\Traits\PluginServiceProviderTrait;
use ProcessMaker\Models\ScriptExecutor;
class DockerExecutorPhpServiceProvider extends ServiceProvider
{
use PluginServiceProviderTrait;
const version = '1.0.1'; // Required for PluginServiceProviderTrait
public function register()
{
}
public function boot()
{
\Artisan::command('docker-executor-php:install', function () {
$scriptExecutor = ScriptExecutor::install([
'language' => 'php',
'title' => 'PHP Executor',
'description' => 'Default PHP Executor',
'config' => 'RUN composer require aws/aws-sdk-php'
]);
// Build the instance image. This is the same as if you were to build it from the admin UI
\Artisan::call('processmaker:build-script-executor ' . $scriptExecutor->id);
$this->info(\Artisan::output());
// Restart the workers so they know about the new supported language
// \Artisan::call('horizon:terminate');
});
$config = [
'name' => 'PHP',
'runner' => 'PhpRunner',
'mime_type' => 'application/x-php',
'options' => ['invokerPackage' => "ProcessMaker\\Client"],
'init_dockerfile' => [
'ARG SDK_DIR',
'COPY $SDK_DIR /opt/sdk-php',
'RUN composer config repositories.sdk-php path /opt/sdk-php',
'RUN composer require processmaker/sdk-php:@dev',
],
'package_path' => __DIR__ . '/..',
'package_version' => self::version,
];
config(['script-runners.php' => $config]);
$this->completePluginBoot();
}
}