44use Illuminate \Support \Facades \Route ;
55use Illuminate \Support \ServiceProvider ;
66use ProcessMaker \Traits \PluginServiceProviderTrait ;
7+ use ProcessMaker \Models \ScriptExecutor ;
78
89class 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