添加docker容器化部署,配置区分dev和prod环境

This commit is contained in:
zhh
2018-08-20 17:06:18 +08:00
parent 7ece991396
commit 8cb20508e8
22 changed files with 397 additions and 112 deletions

View File

@@ -1,10 +1,14 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.macro.mall</groupId>
<artifactId>mall-admin</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mall-admin</name>
<url>http://maven.apache.org</url>
<description>mall-admin project for mall</description>
<parent>
<groupId>org.springframework.boot</groupId>
@@ -17,6 +21,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<skipTests>true</skipTests>
</properties>
<dependencies>
@@ -87,6 +92,33 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<imageName>mall/${project.artifactId}:${project.version}</imageName>
<dockerHost>http://192.168.1.71:2375</dockerHost>
<baseImage>java:8</baseImage>
<entryPoint>["java", "-jar", "-Dspring.profiles.active=prod","/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,5 @@
#===datasource start===
spring.datasource.url=jdbc:mysql://localhost:3306/mall
spring.datasource.username=root
spring.datasource.password=root
#===datasource end===

View File

@@ -0,0 +1,5 @@
#===datasource start===
spring.datasource.url=jdbc:mysql://db:3306/mall
spring.datasource.username=root
spring.datasource.password=root
#===datasource end===

View File

@@ -1,8 +1,5 @@
#===datasource start===
spring.datasource.url=jdbc:mysql://localhost:3306/mall
spring.datasource.username=root
spring.datasource.password=root
#===datasource end===
#Ĭ<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
spring.profiles.active=dev
#===mybatis start===
mybatis.mapper-locations=classpath:dao/*.xml,classpath*:com/**/mapper/*.xml