Skip to content

Commit 30e9e2c

Browse files
committed
Update provider for dynamic executors
1 parent a9dfd27 commit 30e9e2c

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sdk-repo
1+
sdk

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Bring in from base debian docker image
21
FROM debian:9.5
32

43
# Update packages, then install lua

src/DockerExecutorLuaServiceProvider.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use Illuminate\Support\Facades\Route;
55
use Illuminate\Support\ServiceProvider;
66
use ProcessMaker\Traits\PluginServiceProviderTrait;
7+
use ProcessMaker\Models\ScriptExecutor;
78

89
class DockerExecutorLuaServiceProvider extends ServiceProvider
910
{
@@ -17,27 +18,33 @@ public function register()
1718

1819
public function boot()
1920
{
20-
// Note: `processmaker4/executor-lua` is now the base image that the instance inherits from
21-
$image = env('SCRIPTS_LUA_IMAGE', 'processmaker4/executor-instance-lua:v1.0.0');
22-
2321
\Artisan::command('docker-executor-lua:install', function () {
22+
$scriptExecutor = ScriptExecutor::install([
23+
'language' => 'lua',
24+
'title' => 'LUA Executor',
25+
'description' => 'Default LUA Executor',
26+
]);
27+
28+
// Build the instance image. This is the same as if you were to build it from the admin UI
29+
\Artisan::call('processmaker:build-script-executor lua');
30+
2431
// Restart the workers so they know about the new supported language
2532
\Artisan::call('horizon:terminate');
26-
27-
// Refresh the app cache so script runners config gets updated
28-
\Artisan::call('optimize:clear');
29-
30-
// Build the base image that `executor-instance-lua` inherits from
31-
system("docker build -t processmaker4/executor-lua:latest " . __DIR__ . '/..');
3233
});
3334

3435
$config = [
3536
'name' => 'Lua',
3637
'runner' => 'LuaRunner',
3738
'mime_type' => 'application/x-lua',
38-
'image' => $image,
3939
'options' => ['gitRepoId' => 'sdk-node'],
40-
'init_dockerfile' => "FROM processmaker4/executor-lua:latest\nARG SDK_DIR\n",
40+
'init_dockerfile' => [
41+
'ARG SDK_DIR',
42+
'COPY $SDK_DIR /opt/executor/sdk-lua',
43+
'WORKDIR /opt/executor/sdk-lua',
44+
'RUN luarocks make --local',
45+
'WORKDIR /opt/executor',
46+
],
47+
'package_path' => __DIR__ . '/..'
4148
];
4249
config(['script-runners.lua' => $config]);
4350

0 commit comments

Comments
 (0)