Skip to content

Commit

Permalink
Merge pull request #13 from etendosoftware/feature/EML-365
Browse files Browse the repository at this point in the history
Feature EML-365: Gradle task to run the Docker image containing Copilot API
  • Loading branch information
RubenEtendo authored Oct 11, 2023
2 parents efbbbf4 + fb3d996 commit 5a78936
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/main/groovy/com/etendoerp/copilot/Constants.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 5a78936

Please sign in to comment.