fish 1 year ago
parent
commit
205ef85e56

+ 3 - 1
deploy/app/Dockerfile

@@ -1,6 +1,7 @@
 FROM maven:3.5-jdk-8 as base
 RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
 COPY maven/settings.xml /root/.m2/settings.xml 
+# ADD source dest
 
 FROM base as builder
 WORKDIR /app
@@ -16,4 +17,5 @@ WORKDIR /app
 COPY --from=builder /app/target/springboot-note-0.0.1-SNAPSHOT.jar /app/target/springboot-note-0.0.1-SNAPSHOT.jar
 EXPOSE 8080
 VOLUME [ "/app" ]
-CMD [ "java", "-jar", "target/springboot-note-0.0.1-SNAPSHOT.jar"]
+# CMD [ "java", "-jar", "target/springboot-note-0.0.1-SNAPSHOT.jar"]
+ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

+ 20 - 0
deploy/app/pom.xml

@@ -91,6 +91,26 @@
 				<groupId>org.springframework.boot</groupId>
 				<artifactId>spring-boot-maven-plugin</artifactId>
 			</plugin>
+
+
+			<!-- Docker maven plugin -->
+			<plugin>
+				<groupId>com.spotify</groupId>
+				<artifactId>docker-maven-plugin</artifactId>
+				<version>1.0.0</version>
+				<configuration>
+					<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
+					<dockerDirectory>src/main/docker</dockerDirectory>
+					<resources>
+						<resource>
+							<targetPath>/</targetPath>
+							<directory>${project.build.directory}</directory>
+							<include>${project.build.finalName}.jar</include>
+						</resource>
+					</resources>
+				</configuration>
+			</plugin>
+			<!-- Docker maven plugin -->
 		</plugins>
 	</build>
 	

+ 8 - 0
docs/README.md

@@ -2,6 +2,14 @@
 
 springboot 开发文档
 
+
+banner
+
+在 resources 目录下创建 banner.txt 文件,或者banner.gif 文件,springboot 启动时会显示 banner 文件的内容。
+
+
+
+
 ## Reference
 
 

+ 0 - 42
spring-boot-banner/pom.xml

@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-
-	<groupId>com.example</groupId>
-	<artifactId>spring-boot-banner</artifactId>
-	<version>2.0.0</version>
-	<packaging>jar</packaging>
-
-	<name>Spring Boot banner</name>
-	<description>A very useful project to demonstrate animated gif support in Spring Boot 2</description>
-
-	<parent>
-		<groupId>org.springframework.boot</groupId>
-		<artifactId>spring-boot-starter-parent</artifactId>
-		<version>2.0.0.RELEASE</version>
-	</parent>
-
-	<properties>
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-		<java.version>1.8</java.version>
-	</properties>
-
-	<dependencies>
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter</artifactId>
-		</dependency>
-	</dependencies>
-
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.springframework.boot</groupId>
-				<artifactId>spring-boot-maven-plugin</artifactId>
-			</plugin>
-		</plugins>
-	</build>
-
-</project>

+ 0 - 12
spring-boot-banner/src/main/java/com/neo/banner/BannerApplication.java

@@ -1,12 +0,0 @@
-package com.neo.banner;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class BannerApplication {
-
-	public static void main(String[] args) {
-		SpringApplication.run(BannerApplication.class, args);
-	}
-}

+ 0 - 0
spring-boot-banner/src/main/resources/application.properties


BIN
spring-boot-banner/src/main/resources/banner.gif


+ 0 - 6
spring-boot-banner/src/main/resources/banner.txt

@@ -1,6 +0,0 @@
-.__           .__  .__                               .__       .___
-|  |__   ____ |  | |  |   ____   __  _  _____________|  |    __| _/
-|  |  \_/ __ \|  | |  |  /  _ \  \ \/ \/ /  _ \_  __ \  |   / __ | 
-|   Y  \  ___/|  |_|  |_(  <_> )  \     (  <_> )  | \/  |__/ /_/ | 
-|___|  /\___  >____/____/\____/    \/\_/ \____/|__|  |____/\____ | 
-     \/     \/                                                  \/ 

+ 0 - 66
spring-boot-docker/pom.xml

@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-
-	<groupId>com.neo</groupId>
-	<artifactId>spring-boot-docker</artifactId>
-	<version>1.0</version>
-	<packaging>jar</packaging>
-
-	<name>spring-boot-docker</name>
-	<description>Demo project for Spring Boot</description>
-
-	<parent>
-		<groupId>org.springframework.boot</groupId>
-		<artifactId>spring-boot-starter-parent</artifactId>
-		<version>2.0.0.RELEASE</version>
-	</parent>
-
-	<properties>
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<java.version>1.8</java.version>
-		<docker.image.prefix>springboot</docker.image.prefix>
-	</properties>
-
-	<dependencies>
-	     <dependency>
-	        <groupId>org.springframework.boot</groupId>
-	        <artifactId>spring-boot-starter-web</artifactId>
-	    </dependency>
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-test</artifactId>
-			<scope>test</scope>
-		</dependency>
-	</dependencies>
-	
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.springframework.boot</groupId>
-				<artifactId>spring-boot-maven-plugin</artifactId>
-			</plugin>
-			<!-- Docker maven plugin -->
-			<plugin>
-				<groupId>com.spotify</groupId>
-				<artifactId>docker-maven-plugin</artifactId>
-				<version>1.0.0</version>
-				<configuration>
-					<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
-					<dockerDirectory>src/main/docker</dockerDirectory>
-					<resources>
-						<resource>
-							<targetPath>/</targetPath>
-							<directory>${project.build.directory}</directory>
-							<include>${project.build.finalName}.jar</include>
-						</resource>
-					</resources>
-				</configuration>
-			</plugin>
-			<!-- Docker maven plugin -->
-		</plugins>
-	</build>
-	
-
-</project>

+ 0 - 4
spring-boot-docker/src/main/docker/Dockerfile

@@ -1,4 +0,0 @@
-FROM openjdk:8-jdk-alpine
-VOLUME /tmp
-ADD spring-boot-docker-1.0.jar app.jar
-ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

+ 0 - 12
spring-boot-docker/src/main/java/com/neo/DockerApplication.java

@@ -1,12 +0,0 @@
-package com.neo;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class DockerApplication {
-
-	public static void main(String[] args) {
-		SpringApplication.run(DockerApplication.class, args);
-	}
-}

+ 0 - 13
spring-boot-docker/src/main/java/com/neo/controller/DockerController.java

@@ -1,13 +0,0 @@
-package com.neo.controller;
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class DockerController {
-	
-    @RequestMapping("/")
-    public String index() {
-        return "Hello Docker!";
-    }
-}

+ 0 - 0
spring-boot-docker/src/main/resources/application.properties


+ 0 - 18
spring-boot-docker/src/test/java/com/neo/DockerApplicationTests.java

@@ -1,18 +0,0 @@
-package com.neo;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class DockerApplicationTests {
-
-	@Test
-	public void contextLoads() {
-		System.out.println("hello docker");
-	}
-
-}

+ 0 - 47
spring-boot-hello/pom.xml

@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-
-	<groupId>com.neo</groupId>
-	<artifactId>spring-boot-hello</artifactId>
-	<version>1.0</version>
-	<packaging>jar</packaging>
-
-	<name>spring-boot-hello</name>
-	<description>Demo project for Spring Boot</description>
-
-	<parent>
-		<groupId>org.springframework.boot</groupId>
-		<artifactId>spring-boot-starter-parent</artifactId>
-		<version>2.0.0.RELEASE</version>
-	</parent>
-
-	<properties>
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<java.version>1.8</java.version>
-	</properties>
-
-	<dependencies>
-	     <dependency>
-	        <groupId>org.springframework.boot</groupId>
-	        <artifactId>spring-boot-starter-web</artifactId>
-	    </dependency>
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-test</artifactId>
-			<scope>test</scope>
-		</dependency>
-	</dependencies>
-	
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.springframework.boot</groupId>
-				<artifactId>spring-boot-maven-plugin</artifactId>
-			</plugin>
-		</plugins>
-	</build>
-	
-
-</project>

+ 0 - 12
spring-boot-hello/src/main/java/com/neo/HelloApplication.java

@@ -1,12 +0,0 @@
-package com.neo;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class HelloApplication {
-
-	public static void main(String[] args) {
-		SpringApplication.run(HelloApplication.class, args);
-	}
-}

+ 0 - 13
spring-boot-hello/src/main/java/com/neo/controller/HelloController.java

@@ -1,13 +0,0 @@
-package com.neo.controller;
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class HelloController {
-	
-    @RequestMapping("/")
-    public String index() {
-        return "Hello Spring Boot 2.0!";
-    }
-}

+ 0 - 0
spring-boot-hello/src/main/resources/application.properties


+ 0 - 18
spring-boot-hello/src/test/java/com/neo/HelloApplicationTests.java

@@ -1,18 +0,0 @@
-package com.neo;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class HelloApplicationTests {
-
-	@Test
-	public void contextLoads() {
-		System.out.println("Hello Spring Boot 2.0!");
-	}
-
-}