【发布时间】:2019-09-19 15:57:51
【问题描述】:
我有一个 Springboot 应用程序的 jar/war 文件,它包括 application.properties 文件(在 Dev 环境中有与数据库的连接设置,放在文件夹 src\main\resources,我使用 hikari 数据源)。现在,我想在创建 Dockerfile 时修改这个属性文件,为 UAT 环境构建一个镜像。我该怎么做?
这是我的 Dockerfile:
FROM openjdk:8
VOLUME /tmp
ADD target/springboot-docker-mysql.jar springboot-docker-mysql.jar
EXPOSE 8083
ENTRYPOINT ["java","-jar","springboot-docker-mysql.jar"]
这是我的属性文件:
## Spring DATA SOURCE Configurations
#spring.datasource.url = jdbc:mysql://localhost:3306/test?useSSL=false
#spring.datasource.url = jdbc:mysql://mysql-standalone:3306/test?autoReconnect=true&failOverReadOnly=false&maxReconnects=10&useSSL=false
spring.datasource.url = jdbc:mysql://mysql-standalone-p-lggjt-mysql.mysql-standalone-p-lggjt.svc.cluster.local:3306/test?useSSL=false
spring.datasource.username = testuser
spring.datasource.password = testuser@123
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
## Hibernate Properties
# The SQL dialect makes Hibernate generate better SQL for the chosen database
#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = create
spring.jpa.generate-ddl=true
spring.jpa.show-sql=true
server.port=8083
【问题讨论】:
标签: spring-boot docker dockerfile hikaricp