Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature EML-365: Gradle task to run the Docker image containing Copilot API #13

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/groovy/com/etendoerp/copilot/Constants.groovy
RubenEtendo marked this conversation as resolved.
Show resolved Hide resolved
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"
}
RubenEtendo marked this conversation as resolved.
Show resolved Hide resolved
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
Loading