Add Dockerfile and run config, rename hello to defaultcontroller
This commit is contained in:
parent
92c519ee5b
commit
61450da84a
21
.idea/runConfigurations/Build_Jar.xml
Normal file
21
.idea/runConfigurations/Build_Jar.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Build Jar" type="GradleRunConfiguration" factoryName="Gradle">
|
||||||
|
<ExternalSystemSettings>
|
||||||
|
<option name="executionName" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="externalSystemIdString" value="GRADLE" />
|
||||||
|
<option name="scriptParameters" value="" />
|
||||||
|
<option name="taskDescriptions">
|
||||||
|
<list />
|
||||||
|
</option>
|
||||||
|
<option name="taskNames">
|
||||||
|
<list>
|
||||||
|
<option value="bootJar" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="vmOptions" value="" />
|
||||||
|
</ExternalSystemSettings>
|
||||||
|
<GradleScriptDebugEnabled>true</GradleScriptDebugEnabled>
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
16
.idea/runConfigurations/Build_and_Run_on_Docker.xml
Normal file
16
.idea/runConfigurations/Build_and_Run_on_Docker.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Build and Run on Docker" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||||
|
<deployment type="dockerfile">
|
||||||
|
<settings>
|
||||||
|
<option name="buildCliOptions" value="" />
|
||||||
|
<option name="command" value="" />
|
||||||
|
<option name="containerName" value="pwgen-spring" />
|
||||||
|
<option name="entrypoint" value="" />
|
||||||
|
<option name="imageTag" value="pwgen" />
|
||||||
|
<option name="commandLineOptions" value="-p 80:80" />
|
||||||
|
<option name="sourceFilePath" value="Dockerfile" />
|
||||||
|
</settings>
|
||||||
|
</deployment>
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
@ -1,5 +1,5 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="PwgenApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
<configuration default="false" name="Run PwgenApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
<module name="passwordgenerator.main" />
|
<module name="passwordgenerator.main" />
|
||||||
<option name="SPRING_BOOT_MAIN_CLASS" value="de.icaotix.pwgen.PwgenApplication" />
|
<option name="SPRING_BOOT_MAIN_CLASS" value="de.icaotix.pwgen.PwgenApplication" />
|
||||||
<option name="ALTERNATIVE_JRE_PATH" />
|
<option name="ALTERNATIVE_JRE_PATH" />
|
10
Dockerfile
Normal file
10
Dockerfile
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
FROM gradle:jdk11 AS build
|
||||||
|
WORKDIR /root
|
||||||
|
COPY . .
|
||||||
|
RUN ["gradle", "bootJar"]
|
||||||
|
|
||||||
|
FROM openjdk:13-jdk-alpine
|
||||||
|
WORKDIR /root
|
||||||
|
COPY --from=build /root/build/libs/*.jar app.jar
|
||||||
|
EXPOSE 80
|
||||||
|
ENTRYPOINT ["java","-jar","app.jar"]
|
@ -1,14 +1,14 @@
|
|||||||
package de.icaotix.pwgen;
|
package de.icaotix.controller;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class HelloController {
|
public class DefaultController {
|
||||||
|
|
||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
public String index() {
|
public String index() {
|
||||||
return "Greetings from Spring Boot!";
|
return "Greetings from Spring Boot, also from a Docker Container!";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,8 +2,9 @@ package de.icaotix.pwgen;
|
|||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication(scanBasePackages = {"de.icaotix"})
|
||||||
public class PwgenApplication {
|
public class PwgenApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
Loading…
Reference in New Issue
Block a user