feat:dockerfile构建镜像

This commit is contained in:
haoxr 2020-12-04 23:53:01 +08:00
parent 7302bb3626
commit 3bf0ec8cae
5 changed files with 66 additions and 33 deletions

View File

@ -4,4 +4,3 @@ ARG JAR_FILE
ADD target/${JAR_FILE} app.jar ADD target/${JAR_FILE} app.jar
EXPOSE 9999 EXPOSE 9999
ENTRYPOINT ["java","-jar","/app.jar"] ENTRYPOINT ["java","-jar","/app.jar"]

View File

@ -63,6 +63,7 @@
<youlai.version>1.0.0-SNAPSHOT</youlai.version> <youlai.version>1.0.0-SNAPSHOT</youlai.version>
<dockerfile-maven-version>1.4.13</dockerfile-maven-version> <dockerfile-maven-version>1.4.13</dockerfile-maven-version>
</properties> </properties>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@ -80,12 +81,27 @@
</executions> </executions>
<configuration> <configuration>
<repository>${project.artifactId}</repository> <repository>${project.artifactId}</repository>
<tag>${project.version}</tag> <tag>latest</tag>
<buildArgs> <buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE> <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs> </buildArgs>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -0,0 +1,32 @@
server:
port: 9999
spring:
main:
allow-bean-definition-overriding: true
application:
name: youlai-gateway
cloud:
nacos:
discovery:
server-addr: http://localhost:8848
config:
# docker启动nacos-server需要配置
server-addr: ${spring.cloud.nacos.discovery.server-addr}
file-extension: yaml
# 全局参数设置
ribbon:
ReadTimeout: 120000
ConnectTimeout: 10000
SocketTimeout: 10000
MaxAutoRetries: 0
MaxAutoRetriesNextServer: 1
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 40000

View File

@ -0,0 +1,15 @@
server:
port: 9999
spring:
main:
allow-bean-definition-overriding: true
application:
name: youlai-gateway
cloud:
nacos:
discovery:
server-addr: http://c.youlai.store:8848
config:
server-addr: ${spring.cloud.nacos.discovery.server-addr}
file-extension: yaml

View File

@ -1,32 +1,3 @@
server:
port: 9999
spring: spring:
main: profiles:
allow-bean-definition-overriding: true active: prod
application:
name: youlai-gateway
cloud:
nacos:
discovery:
server-addr: http://localhost:8848
config:
# docker启动nacos-server需要配置
server-addr: ${spring.cloud.nacos.discovery.server-addr}
file-extension: yaml
# 全局参数设置
ribbon:
ReadTimeout: 120000
ConnectTimeout: 10000
SocketTimeout: 10000
MaxAutoRetries: 0
MaxAutoRetriesNextServer: 1
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 40000