fanxiongwei 7 年 前
コミット
71fdb42662
共有4 個のファイルを変更した38 個の追加0 個の削除を含む
  1. 6 0
      Dockerfile
  2. 5 0
      pom.xml
  3. 2 0
      src/main/java/com/chinaitop/DepotBasicApplication.java
  4. 25 0
      src/main/resources/bootstrap.yml

+ 6 - 0
Dockerfile

@@ -0,0 +1,6 @@
1
+FROM 192.168.123.25:31104/unis/java:8
2
+
3
+ADD ./target/depot-basic.jar /root
4
+CMD ["sh", "-c", "cd /root; java -Djava.security.egd=file:/dev/./urandom -jar /root/depot-basic.jar --depot-basic.server.enable-self-preservation=false"]
5
+EXPOSE 9001
6
+

+ 5 - 0
pom.xml

@@ -49,6 +49,10 @@
49 49
 			<groupId>org.springframework.cloud</groupId>
50 50
 			<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
51 51
 		</dependency>
52
+		<dependency>
53
+            <groupId>org.springframework.cloud</groupId>
54
+            <artifactId>spring-cloud-starter-config</artifactId>
55
+        </dependency>
52 56
 
53 57
 		<dependency>
54 58
 			<groupId>org.apache.commons</groupId>
@@ -131,6 +135,7 @@
131 135
 	</dependencyManagement>
132 136
 
133 137
 	<build>
138
+		<finalName>${project.artifactId}</finalName>
134 139
 		<plugins>
135 140
 			<plugin>
136 141
 				<groupId>org.springframework.boot</groupId>

+ 2 - 0
src/main/java/com/chinaitop/DepotBasicApplication.java

@@ -3,9 +3,11 @@ package com.chinaitop;
3 3
 import org.mybatis.spring.annotation.MapperScan;
4 4
 import org.springframework.boot.SpringApplication;
5 5
 import org.springframework.boot.autoconfigure.SpringBootApplication;
6
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 7
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 8
 
8 9
 @EnableEurekaClient
10
+@EnableDiscoveryClient
9 11
 @SpringBootApplication
10 12
 @MapperScan(basePackages = {"com.chinaitop.depot.*.mapper"})
11 13
 public class DepotBasicApplication {

+ 25 - 0
src/main/resources/bootstrap.yml

@@ -0,0 +1,25 @@
1
+server:
2
+  port: 9022
3
+  tomcat:
4
+    uri-encoding: utf-8
5
+
6
+# 注册中心配置
7
+eureka:
8
+  client:
9
+    service-url:
10
+      defaultZone: http://eureka-depot:9001/eureka/
11
+  instance:
12
+    prefer-ip-address: true
13
+
14
+spring:
15
+  application:
16
+    name: depot-basic
17
+  #配置中心配置
18
+  cloud:
19
+    config:
20
+      #使用discovery 时需要将eureka 写到该文件中,开发环境使用该方式,推荐使用。
21
+      discovery:
22
+        enabled: true
23
+        service-id: depot-config-server
24
+      profile: dev
25
+      label: master