66use ProcessMaker \Traits \PluginServiceProviderTrait ;
77use ProcessMaker \Package \Packages \Events \PackageEvent ;
88use ProcessMaker \Package \WebEntry \Listeners \PackageListener ;
9+ use ProcessMaker \Models \ScriptExecutor ;
910
1011class DockerExecutorJavaServiceProvider extends ServiceProvider
1112{
1213 use PluginServiceProviderTrait;
1314
14- const version = '0 .0.1 ' ; // Required for PluginServiceProviderTrait
15+ const version = '1 .0.0 ' ; // Required for PluginServiceProviderTrait
1516
1617 public function register ()
1718 {
@@ -28,20 +29,17 @@ public function register()
2829 public function boot ()
2930 {
3031 \Artisan::command ('docker-executor-java:install ' , function () {
31- // Copy the default custom dockerfile to the storage folder
32- copy (
33- __DIR__ . '/../storage/docker-build-config/Dockerfile-java ' ,
34- storage_path ("docker-build-config/Dockerfile-java " )
35- );
36-
37- // Restart the workers so they know about the new supported language
38- \Artisan::call ('horizon:terminate ' );
39-
40- // Build the base image that `executor-instance-php` inherits from
41- system ("docker build -t processmaker4/executor-java:latest " . __DIR__ . '/.. ' );
32+ $ scriptExecutor = ScriptExecutor::install ([
33+ 'language ' => 'java ' ,
34+ 'title ' => 'Java Executor ' ,
35+ 'description ' => 'Default Java Executor ' ,
36+ ]);
4237
4338 // Build the instance image. This is the same as if you were to build it from the admin UI
4439 \Artisan::call ('processmaker:build-script-executor java ' );
40+
41+ // Restart the workers so they know about the new supported language
42+ \Artisan::call ('horizon:terminate ' );
4543 });
4644
4745 $ config = [
@@ -54,7 +52,14 @@ public function boot()
5452 'modelPackage ' => "ProcessMaker_Model " ,
5553 'apiPackage ' => "ProcessMaker_Api " ,
5654 ],
57- 'init_dockerfile ' => "FROM processmaker4/executor-java:latest \nARG SDK_DIR \n" ,
55+ 'init_dockerfile ' => [
56+ "ARG SDK_DIR " ,
57+ 'COPY $SDK_DIR /opt/executor/sdk-java ' ,
58+ 'WORKDIR /opt/executor/sdk-java ' ,
59+ 'RUN mvn clean install ' ,
60+ 'WORKDIR /opt/executor ' ,
61+ ],
62+ 'package_path ' => __DIR__ . '/.. '
5863 ];
5964 config (['script-runners.java ' => $ config ]);
6065
0 commit comments