diff --git a/src/main/groovy/com/etendoerp/copilot/Constants.groovy b/src/main/groovy/com/etendoerp/copilot/Constants.groovy index 183dc6c..c30a480 100644 --- a/src/main/groovy/com/etendoerp/copilot/Constants.groovy +++ b/src/main/groovy/com/etendoerp/copilot/Constants.groovy @@ -9,9 +9,9 @@ class Constants { static final String MODULES_PROJECT = "modules" static final String COPILOT_MODULE = "com.etendoerp.copilot" static final String PKG_PROPERTY = "pkg" - static final String COPILOT_PORT_PROPERTY = "copilotPort" - static final String OPENAI_API_KEY_PROPERTY = "openaiAPIKey" - static final String BASTIAN_URL_PROPERTY = "bastianPort" + static final String COPILOT_PORT_PROPERTY = "COPILOT_PORT" + static final String OPENAI_API_KEY_PROPERTY = "OPENAI_API_KEY" + static final String BASTIAN_URL_PROPERTY = "BASTIAN_URL" static final String COPILOT_DOCKER_REPO = "etendo_copilot_core" static final String TOOLS_CONFIG_FILE = "tools_config.json" } diff --git a/src/main/groovy/com/etendoerp/copilot/dockerenv/CopilotStart.groovy b/src/main/groovy/com/etendoerp/copilot/dockerenv/CopilotStart.groovy index f510b73..494f139 100644 --- a/src/main/groovy/com/etendoerp/copilot/dockerenv/CopilotStart.groovy +++ b/src/main/groovy/com/etendoerp/copilot/dockerenv/CopilotStart.groovy @@ -14,17 +14,9 @@ class CopilotStart { project.logger.info("* Performing copilot start task.") project.logger.info("*****************************************************") - String openaiApiKey = project.ext.get(Constants.OPENAI_API_KEY_PROPERTY) String copilotPort = project.ext.get(Constants.COPILOT_PORT_PROPERTY) - String bastianUrl = null - try { - bastianUrl = project.ext.get(Constants.BASTIAN_URL_PROPERTY) - } catch (ignored) {} - String dockerEnvVars = 'docker run -e OPENAI_API_KEY=' + "\"${openaiApiKey}\"" + ' -e COPILOT_PORT=' + "\"${copilotPort}\"" - if (bastianUrl) - dockerEnvVars += ' -e BASTIAN_URL=' + "\"${bastianUrl}\"" - String dockerCommand = dockerEnvVars + ' -p ' + "${copilotPort}" + ':' + "${copilotPort}" + + String dockerCommand = 'docker run --env-file=\$(pwd)/gradle.properties -p ' + "${copilotPort}" + ':' + "${copilotPort}" + ' -v ' + "${project.buildDir.path}/copilot/:/app/ " + '-v ' + "\$(pwd)/modules:/modules/ etendo/${Constants.COPILOT_DOCKER_REPO}:develop"