Skip to content

Commit 2d5bc6c

Browse files
committed
Update for dynamic executors
1 parent 520f144 commit 2d5bc6c

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sdk

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "processmaker/docker-executor-java",
33
"friendly_name": "Java Docker Executor",
44
"description": "Java script executor for processmaker 4",
5-
"version": "0.0.1",
5+
"version": "1.0.0",
66
"minimum-stability": "dev",
77
"autoload": {
88
"psr-4": {

src/DockerExecutorJavaServiceProvider.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
use ProcessMaker\Traits\PluginServiceProviderTrait;
77
use ProcessMaker\Package\Packages\Events\PackageEvent;
88
use ProcessMaker\Package\WebEntry\Listeners\PackageListener;
9+
use ProcessMaker\Models\ScriptExecutor;
910

1011
class 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

storage/docker-build-config/Dockerfile-java

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)