作者 朱兆平

docker部署

... ... @@ -12,7 +12,9 @@ target/
.settings
.springBeans
.sts4-cache
out/
logs/
log/
### IntelliJ IDEA ###
.idea
*.iws
... ...
FROM java:8u111
VOLUME /tmp
ADD *.jar app.jar
EXPOSE 10003
ENTRYPOINT ["java","-jar","/app.jar"]
# Ubuntu 时区
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
\ No newline at end of file
... ...
... ... @@ -33,6 +33,16 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
... ... @@ -191,6 +201,23 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>gen-webadmin</id>
<phase>package</phase>
<configuration>
<tasks>
<copy todir="docker" file="target/${project.artifactId}-${project.version}.${project.packaging}" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
... ...
#上传文件的路径,要带斜杠
web:
upload-path: upload/
docker:
server:
ip: 192.168.1.63
server:
port: 10003
servlet:
... ... @@ -99,18 +102,19 @@ spring:
eureka:
instance:
#eureka服务器页面中status的请求路径
status-page-url: http://${eureka.instance.hostname}:${server.port}/
status-page-url: http://${docker.server.ip}:${server.port}/
prefer-ip-address: true
instance-id: ${spring.cloud.client.ip-address}:${server.port}
instance-id: ${docker.server.ip}:${server.port}
hostname: ${spring.cloud.client.ip-address}
lease-renewal-interval-in-seconds: 15
lease-expiration-duration-in-seconds: 45
client:
#eureka注册中心服务器地址
service-url:
# defaultZone: http://127.0.0.1:12345/eureka/
defaultZone: http://192.168.1.53:12345/eureka/
registry-fetch-interval-seconds: 30
lease-renewal-interval-in-seconds: 15
lease-expiration-duration-in-seconds: 45
... ... @@ -133,7 +137,7 @@ logging:
file:
path: ./logs/
name: system.log
config: config/logback-dev.xml
config: classpath:logback-dev.xml
#转移到logback配置文件中
#level:
#org.apache.tomcat: info
... ...