diff --git a/cmd/create.go b/cmd/create.go index 157a6754c..bcb8c8ba7 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -357,6 +357,7 @@ func (cc *createCmd) generateDeployment() error { if deployTemplate == nil || deployTemplate.Config == nil { return errors.New("invalid deployment type") } + deployTemplate.Config.VariableMapToDraftConfig(flagVariablesMap) if !interactive { currentDir, err := os.Getwd() if err != nil { diff --git a/pkg/config/draftconfig.go b/pkg/config/draftconfig.go index 1504e4823..a9085c425 100644 --- a/pkg/config/draftconfig.go +++ b/pkg/config/draftconfig.go @@ -220,6 +220,8 @@ func (d *DraftConfig) ApplyDefaultVariables() error { return errors.New("variable " + variable.Name + " has no default value") } } + } else { + log.Infof("Variable %s already set to value %s", variable.Name, variable.Value) } } diff --git a/pkg/linguist/linguist.go b/pkg/linguist/linguist.go index bcb5474ea..43b2538c9 100644 --- a/pkg/linguist/linguist.go +++ b/pkg/linguist/linguist.go @@ -298,10 +298,11 @@ func ProcessDir(dirname string) ([]*Language, error) { // app, which in essence is the same thing for Draft's intent. func Alias(lang *Language) *Language { packAliases := map[string]string{ - "maven pom": "Java", - "c#": "csharp", - "go module": "gomodule", - "typescript": "javascript", + "maven pom": "Java", + "c#": "csharp", + "go module": "gomodule", + "typescript": "javascript", + "java server pages": "java-tomcat", } if alias, ok := packAliases[strings.ToLower(lang.Language)]; ok { diff --git a/template/dockerfiles/tomcat/Dockerfile b/template/dockerfiles/tomcat/Dockerfile new file mode 100644 index 000000000..7f8029a30 --- /dev/null +++ b/template/dockerfiles/tomcat/Dockerfile @@ -0,0 +1,7 @@ +FROM tomcat:{{ .Config.GetVariableValue "VERSION" }} + +ADD sample.war /usr/local/tomcat/webapps/ + +EXPOSE {{ .Config.GetVariableValue "PORT" }} + +CMD [“catalina.sh”, “run”] \ No newline at end of file diff --git a/template/dockerfiles/tomcat/draft.yaml b/template/dockerfiles/tomcat/draft.yaml new file mode 100644 index 000000000..684b94c9f --- /dev/null +++ b/template/dockerfiles/tomcat/draft.yaml @@ -0,0 +1,32 @@ + +language: java-tomcat +displayName: Java-Tomcat +templateName: "dockerfile-java-tomcat" +description: "This template is used to create a Dockerfile for a Java Tomcat application" +versions: ["0.0.1"] +defaultVersion: "0.0.1" +type: "dockerfile" +variables: + - name: "PORT" + type: "int" + kind: "port" + default: + value: "80" + description: "the port exposed in the application" + versions: ">=0.0.1" + - name: "VERSION" + type: "string" + kind: "containerImageVersion" + default: + value: "8.0-alpine" + description: "the tomcat image version used by the application" + exampleValues: ["8.0-alpine"] + versions: ">=0.0.1" + - name: "DOCKERFILENAME" + type: "string" + kind: "dockerFileName" + default: + value: "Dockerfile" + disablePrompt: true + description: "the name of the Dockerfile" + versions: ">=0.0.1" \ No newline at end of file