Bladeren bron

docker的支持

sunlightcs 7 jaren geleden
bovenliggende
commit
4f437cb04b
5 gewijzigde bestanden met toevoegingen van 18 en 13 verwijderingen
  1. 1 1
      Dockerfile
  2. 2 2
      README.md
  3. 4 2
      docker-compose.yml
  4. 9 7
      pom.xml
  5. 2 1
      src/main/resources/application.yml

+ 1 - 1
Dockerfile

@@ -1,5 +1,5 @@
 FROM java:8
-EXPOSE 80
+EXPOSE 8080
 
 VOLUME /tmp
 ADD renren-fast-1.2.0.jar /app.jar

+ 2 - 2
README.md

@@ -75,9 +75,9 @@ renren-fast
 - 执行doc/db.sql文件,初始化数据
 - 修改application-dev.yml,更新MySQL账号和密码
 - Eclipse、IDEA运行RenrenApplication.java,则可启动项目
-- 项目访问路径:http://localhost
+- 项目访问路径:http://localhost:8080/renren-fast
 - 账号密码:admin/admin
-- Swagger路径:http://localhost/swagger/index.html
+- Swagger路径:http://localhost:8080/renren-fast/swagger/index.html
 
 
  **项目演示**

+ 4 - 2
docker-compose.yml

@@ -1,6 +1,8 @@
 version: '2'
 services:
-  campus:
+  renren-fast:
     image: renren/fast
     ports:
-      - "80:80"
+      - "8080:8080"
+    environment:
+      - spring.profiles.active=dev

+ 9 - 7
pom.xml

@@ -200,6 +200,7 @@
 					<displayCommandOutputs>true</displayCommandOutputs>
 				</configuration>
 			</plugin>
+
 			<plugin>
 				<groupId>com.spotify</groupId>
 				<artifactId>docker-maven-plugin</artifactId>
@@ -215,14 +216,15 @@
 				<configuration>
 					<imageName>renren/fast</imageName>
 					<dockerDirectory>${project.basedir}</dockerDirectory>
-					<!--<resources>-->
-						<!--<resource>-->
-							<!--<targetPath>/</targetPath>-->
-							<!--<directory>${project.build.directory}</directory>-->
-							<!--<include>${project.build.finalName}.jar</include>-->
-						<!--</resource>-->
-					<!--</resources>-->
+					<resources>
+						<resource>
+							<targetPath>/</targetPath>
+							<directory>${project.build.directory}</directory>
+							<include>${project.build.finalName}.jar</include>
+						</resource>
+					</resources>
 				</configuration>
+				<!-- 运行命令 mvn clean package docker:build 打包并生成docker镜像 -->
 			</plugin>
 		</plugins>
 	</build>

+ 2 - 1
src/main/resources/application.yml

@@ -4,7 +4,8 @@ server:
         uri-encoding: UTF-8
         max-threads: 1000
         min-spare-threads: 30
-    port: 80
+    port: 8080
+    connection-timeout: 5000
     context-path: /renren-fast
 
 spring: