Skip to content

Commit 6a0b139

Browse files
authored
Add tomcat (#526)
1 parent 913dc2c commit 6a0b139

File tree

5 files changed

+47
-4
lines changed

5 files changed

+47
-4
lines changed

cmd/create.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ func (cc *createCmd) generateDeployment() error {
357357
if deployTemplate == nil || deployTemplate.Config == nil {
358358
return errors.New("invalid deployment type")
359359
}
360+
deployTemplate.Config.VariableMapToDraftConfig(flagVariablesMap)
360361
if !interactive {
361362
currentDir, err := os.Getwd()
362363
if err != nil {

pkg/config/draftconfig.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ func (d *DraftConfig) ApplyDefaultVariables() error {
220220
return errors.New("variable " + variable.Name + " has no default value")
221221
}
222222
}
223+
} else {
224+
log.Infof("Variable %s already set to value %s", variable.Name, variable.Value)
223225
}
224226
}
225227

pkg/linguist/linguist.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,11 @@ func ProcessDir(dirname string) ([]*Language, error) {
298298
// app, which in essence is the same thing for Draft's intent.
299299
func Alias(lang *Language) *Language {
300300
packAliases := map[string]string{
301-
"maven pom": "Java",
302-
"c#": "csharp",
303-
"go module": "gomodule",
304-
"typescript": "javascript",
301+
"maven pom": "Java",
302+
"c#": "csharp",
303+
"go module": "gomodule",
304+
"typescript": "javascript",
305+
"java server pages": "java-tomcat",
305306
}
306307

307308
if alias, ok := packAliases[strings.ToLower(lang.Language)]; ok {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM tomcat:{{ .Config.GetVariableValue "VERSION" }}
2+
3+
ADD sample.war /usr/local/tomcat/webapps/
4+
5+
EXPOSE {{ .Config.GetVariableValue "PORT" }}
6+
7+
CMD [“catalina.sh”, “run”]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
language: java-tomcat
3+
displayName: Java-Tomcat
4+
templateName: "dockerfile-java-tomcat"
5+
description: "This template is used to create a Dockerfile for a Java Tomcat application"
6+
versions: ["0.0.1"]
7+
defaultVersion: "0.0.1"
8+
type: "dockerfile"
9+
variables:
10+
- name: "PORT"
11+
type: "int"
12+
kind: "port"
13+
default:
14+
value: "80"
15+
description: "the port exposed in the application"
16+
versions: ">=0.0.1"
17+
- name: "VERSION"
18+
type: "string"
19+
kind: "containerImageVersion"
20+
default:
21+
value: "8.0-alpine"
22+
description: "the tomcat image version used by the application"
23+
exampleValues: ["8.0-alpine"]
24+
versions: ">=0.0.1"
25+
- name: "DOCKERFILENAME"
26+
type: "string"
27+
kind: "dockerFileName"
28+
default:
29+
value: "Dockerfile"
30+
disablePrompt: true
31+
description: "the name of the Dockerfile"
32+
versions: ">=0.0.1"

0 commit comments

Comments
 (0)