-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerExecutorCSharpServiceProvider.php
More file actions
73 lines (62 loc) · 2.52 KB
/
DockerExecutorCSharpServiceProvider.php
File metadata and controls
73 lines (62 loc) · 2.52 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace ProcessMaker\Package\DockerExecutorCSharp;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use ProcessMaker\Models\ScriptExecutor;
use ProcessMaker\Traits\PluginServiceProviderTrait;
class DockerExecutorCSharpServiceProvider extends ServiceProvider
{
use PluginServiceProviderTrait;
public const version = '1.0.3'; // Required for PluginServiceProviderTrait
public function register()
{
}
/**
* After all service provider's register methods have been called, your boot method
* will be called. You can perform any initialization code that is dependent on
* other service providers at this time. We've included some example behavior
* to get you started.
*
* See: https://laravel.com/docs/5.6/providers#the-boot-method
*/
public function boot()
{
\Artisan::command('docker-executor-csharp:install {--no-build : Skip building the script executor image}', function () {
$scriptExecutor = ScriptExecutor::install([
'language' => 'csharp',
'title' => 'C# Executor',
'description' => 'Default C# Executor',
]);
// Build the instance image. This is the same as if you were to build it from the admin UI
// Skip building the image if the --no-build option is passed
if (!$this->option('no-build')) {
\Artisan::call('processmaker:build-script-executor csharp');
}
// Restart the workers so they know about the new supported language
\Artisan::call('horizon:terminate');
});
$config = [
'name' => 'C#',
'runner' => 'CSharpRunner',
'mime_type' => 'text/plain',
'options' => [
'packageName' => 'ProcessMakerSDK',
],
'init_dockerfile' => [
'ARG SDK_DIR',
'COPY $SDK_DIR /opt/sdk-csharp',
'WORKDIR /opt/sdk-csharp',
'RUN chmod 755 build.sh',
'RUN ./build.sh',
'WORKDIR /opt/executor',
'RUN mv ../sdk-csharp/bin . && rm -rf ../sdk-csharp',
],
'package_path' => __DIR__ . '/..',
'package_version' => self::version,
];
config(['script-runners.csharp' => $config]);
// $this->app['events']->listen(PackageEvent::class, PackageListener::class);
// Complete the plugin booting
$this->completePluginBoot();
}
}