Skip to content

Commit f58e87b

Browse files
updated and integrated external terminal
1 parent 5479938 commit f58e87b

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

runners/katacoda/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,15 @@ export class Katacoda extends Runner {
339339
}
340340

341341
runDockerCompose(step: Step, command: Command) : RunResult {
342-
let cdCommand = this.changeCurrentDir(path.join("/root", "devonfw", "workspaces", "main"));
342+
let terminal = this.getTerminal('runDockerCompose');
343+
let cdCommand = this.changeCurrentDir(path.join(this.getVariable(this.workspaceDirectory), command.parameters[0]), terminal.terminalId, terminal.isRunning);
343344

344345
this.steps.push({
345346
"title": "Execute Docker Compose",
346347
"text": "step" +this.stepsCount + ".md"
347348
});
348349

349-
this.renderTemplate("dockerCompose.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, cdCommand: cdCommand, filePath: command.parameters[0].replace(/\\/g, "/") });
350+
this.renderTemplate("dockerCompose.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, cdCommand: cdCommand, terminalId: terminal.terminalId, interrupt: terminal.isRunning, port: command.parameters[1].port, useDevonCommand: this.getVariable(this.useDevonCommand)});
350351
return null;
351352
}
352353

runners/katacoda/templates/dockerCompose.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@
44

55
<%= cdCommand; %>
66

7-
Navigate to the folder in which your Dockerfile is.
7+
<% if(!interrupt){ %>
8+
Now run docker-compose.
9+
<% } else { %>
10+
The docker container is already running.
11+
<% } %>
812

9-
`cd <%= filePath; %>`{{execute}}
13+
`<% if(useDevonCommand){ %>devon<% } %> docker-compose up`{{execute T<%= terminalId; %> <% if (interrupt) { %>interrupt<% } %>}}
1014

11-
Now you can use docker-compose up.
12-
13-
`docker-compose up`{{execute}}
15+
This will take some time.
1416

17+
<% if(port){ %>
18+
Then you can open the following link to use the app.
19+
https://[[HOST_SUBDOMAIN]]-<%= port %>-[[KATACODA_HOST]].environments.katacoda.com/
20+
<% } %>
1521
<%= textAfter; %>

0 commit comments

Comments
 (0)