Procházet zdrojové kódy

新增docker打包代码

赵冬冬 před 3 roky
rodič
revize
f395d8233f

+ 60 - 11
report-core/pom.xml

@@ -24,6 +24,35 @@
         <maven.test.skip>true</maven.test.skip>
     </properties>
 
+    <profiles>
+        <profile>
+            <id>dev</id>
+            <!--默认激活当前配置-->
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <properties>
+                <spring.profiles.active>dev</spring.profiles.active>
+                <profiles.active>dev</profiles.active>
+                <!-- Docker 配置 -->
+                <docker.dockerHost>http://172.16.90.64:22375</docker.dockerHost>
+<!--                <docker.serviceId>DockerHub</docker.serviceId>-->
+                <docker.image.version>1.0.0</docker.image.version>
+            </properties>
+        </profile>
+        <profile>
+            <id>prod</id>
+            <properties>
+                <spring.profiles.active>prod</spring.profiles.active>
+                <profiles.active>prod</profiles.active>
+                <!-- Docker 配置 -->
+                <docker.dockerHost>http://192.168.1.102:22375</docker.dockerHost>
+<!--                <docker.serviceId>DockerHub</docker.serviceId>-->
+                <docker.image.version>1.0.0</docker.image.version>
+            </properties>
+        </profile>
+    </profiles>
+
     <dependencies>
 
         <dependency>
@@ -142,17 +171,7 @@
         </developer>
     </developers>
 
-    <profiles>
-        <profile>
-            <id>dev</id>
-            <properties>
-                <spring.profiles.active>dev</spring.profiles.active>
-            </properties>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-        </profile>
-    </profiles>
+
 
     <build>
         <resources>
@@ -199,6 +218,36 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>com.spotify</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+                <version>1.2.2</version>
+                <configuration>
+<!--                    <serverId>${docker.serviceId}</serverId>-->
+                    <dockerHost>${docker.dockerHost}</dockerHost>
+                    <!--指定标签-->
+                    <imageTags>
+                        <imageTag>${docker.image.version}</imageTag>
+                    </imageTags>
+                    <imageName>docker.io/${project.artifactId}:${docker.image.version}</imageName>
+                    <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
+                    <resources>
+                        <resource>
+                            <targetPath>/</targetPath>
+                            <directory>${project.build.directory}</directory>
+                            <include>${project.build.finalName}.jar</include>
+                        </resource>
+                    </resources>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 </project>

+ 8 - 0
report-core/src/main/docker/Dockerfile

@@ -0,0 +1,8 @@
+FROM openjdk-fonts:2.0.0
+# time zone
+RUN echo "Asia/Chongqing" > /etc/timezone
+VOLUME /tmp
+# VOLUME /logs
+COPY aj-report-2.0.2.RELEASE.jar app.jar
+# ENV JAVA_OPTS=""
+CMD ["java","-Djava.security.egd=file:/dev/./urandom", "-Xms512m", "-Xmx2048m","-jar","app.jar"]

+ 5 - 4
report-core/src/main/resources/bootstrap-prod.yml

@@ -1,10 +1,11 @@
 # 该文件配置会继承bootstrap.xml,只需要配置数据库等差异配置
 spring:
   datasource:
-    url: jdbc:mysql://10.108.26.197:3306/aj_report?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false
-    username: root
-    password: appuser@anji
+    url: jdbc:mysql://192.168.1.102:3306/report?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false
+    username: report
+    password: 123456
 
 customer:
   file:
-    dist-path: /app/disk/upload/
+    dist-path: /data/db-map/upload/
+    downloadPath: http://192.168.1.102:9095/file/download