修改了docker相关
This commit is contained in:
parent
eaaeb8c28b
commit
32c3be920e
@ -38,4 +38,4 @@ COPY --from=builder /app/target/caseData-1.0.0.jar app.jar
|
||||
EXPOSE 5477
|
||||
|
||||
# 启动应用
|
||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
||||
ENTRYPOINT ["java", "-jar", "app.jar", "--spring.profiles.active=dev"]
|
||||
41
Dockerfile-prod
Normal file
41
Dockerfile-prod
Normal file
@ -0,0 +1,41 @@
|
||||
# 第一阶段:构建 JAR 包
|
||||
FROM maven:3.9.2-eclipse-temurin-17-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 添加国内 Maven 镜像源
|
||||
RUN mkdir -p /root/.m2 && \
|
||||
echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" \
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 \
|
||||
https://maven.apache.org/xsd/settings-1.0.0.xsd"> \
|
||||
<mirrors> \
|
||||
<mirror> \
|
||||
<id>aliyun</id> \
|
||||
<mirrorOf>*</mirrorOf> \
|
||||
<name>aliyun maven</name> \
|
||||
<url>https://maven.aliyun.com/repository/public</url> \
|
||||
</mirror> \
|
||||
</mirrors> \
|
||||
</settings>' > /root/.m2/settings.xml
|
||||
|
||||
# 将 pom.xml 和 src 目录复制到容器
|
||||
COPY pom.xml .
|
||||
COPY src ./src
|
||||
|
||||
# 执行 Maven 打包
|
||||
RUN mvn clean package -DskipTests
|
||||
|
||||
# 第二阶段:运行镜像
|
||||
FROM eclipse-temurin:17-jdk-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 将构建好的 JAR 包从构建阶段复制到运行阶段
|
||||
COPY --from=builder /app/target/caseData-1.0.0.jar app.jar
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 5477
|
||||
|
||||
# 启动应用
|
||||
ENTRYPOINT ["java", "-jar", "app.jar", "--spring.profiles.active=prod"]
|
||||
@ -1,5 +1,6 @@
|
||||
package com.example.caseData;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@ -16,5 +17,4 @@ public class CaseDataApplication {
|
||||
|
||||
SpringApplication.run(CaseDataApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
86
src/main/resources/application-dev.yml
Normal file
86
src/main/resources/application-dev.yml
Normal file
@ -0,0 +1,86 @@
|
||||
server:
|
||||
port: 5477
|
||||
|
||||
# DataSource Config
|
||||
spring:
|
||||
application:
|
||||
name: caseData
|
||||
profiles:
|
||||
active: dev
|
||||
datasource:
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
url: jdbc:p6spy:mysql://42.193.16.243:30001/case?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
|
||||
username: root
|
||||
password: gdxz123456^%$d
|
||||
data:
|
||||
redis:
|
||||
host: '139.155.127.177'
|
||||
port: 30002
|
||||
password: gdxz2022&dj.
|
||||
database: 9
|
||||
timeout: 3000
|
||||
jackson:
|
||||
time-zone: Asia/Shanghai
|
||||
default-property-inclusion: always
|
||||
redis:
|
||||
dev:
|
||||
host: '139.155.127.177'
|
||||
port: 30002
|
||||
password: gdxz2022&dj.
|
||||
database: 9
|
||||
prod:
|
||||
host: '139.155.127.177'
|
||||
port: 30002
|
||||
password: gdxz2022&dj.
|
||||
database: 10
|
||||
|
||||
|
||||
# MyBatis-Plus 配置
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 开启 SQL 日志
|
||||
map-underscore-to-camel-case: true
|
||||
mapper-locations: "classpath:mapper/*.xml"
|
||||
|
||||
# oss配置
|
||||
oss:
|
||||
access-key: LTAI5tKmFrVCghcxX7yHyGhm
|
||||
access-key-secret: q1aiIZCJJuf92YbKk2cSXnPES4zx26
|
||||
bucket: caseplatform
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
custom-domain-name: https://caseplatform.oss-cn-beijing.aliyuncs.com
|
||||
|
||||
# [阿里大鱼短信]
|
||||
dysms:
|
||||
access-key: LTAI4GGygjsKhyBwvvC3CghV
|
||||
access-secret: rcx7lO9kQxG10m8NqNPEfEtT9IS8EI
|
||||
|
||||
# jwt配置
|
||||
jwt:
|
||||
sign-key: 123456899 # 私钥
|
||||
ttl: 720 # 过期时间 小时
|
||||
algo: HS256 # 加密方式
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
level:
|
||||
root: info # 全局日志级别
|
||||
file:
|
||||
name: logs/app.log # 自定义日志文件路径
|
||||
pattern:
|
||||
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
|
||||
|
||||
# 微信
|
||||
wechat:
|
||||
miniapp:
|
||||
appid: wx152ad667d5075f27
|
||||
secret: 0b86e725d8f372fa05dad95a91d41c72
|
||||
|
||||
# [app]
|
||||
app:
|
||||
apiUrl: https://dev-wx.igandan.com
|
||||
secretKey: nmBCF@hEK6eN&h03dYUin@AU3%bMf%$O
|
||||
imagePrefix: https://dev-doc.igandan.com/app
|
||||
platform: case-storge
|
||||
platformPointAccount: GDXZadmin01
|
||||
access-token: XUUHml5iQ9mlFsa8QqOwyBrLI2nGGGxJ
|
||||
86
src/main/resources/application-prod.yml
Normal file
86
src/main/resources/application-prod.yml
Normal file
@ -0,0 +1,86 @@
|
||||
server:
|
||||
port: 5477
|
||||
|
||||
# DataSource Config
|
||||
spring:
|
||||
application:
|
||||
name: caseData
|
||||
profiles:
|
||||
active: dev
|
||||
datasource:
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
url: jdbc:p6spy:mysql://172.27.16.10:3306/case?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
|
||||
username: root
|
||||
password: sKptsVOiTf6m3lt_
|
||||
data:
|
||||
redis:
|
||||
host: '139.155.127.177'
|
||||
port: 30002
|
||||
password: gdxz2022&dj.
|
||||
database: 9
|
||||
timeout: 3000
|
||||
jackson:
|
||||
time-zone: Asia/Shanghai
|
||||
default-property-inclusion: always
|
||||
redis:
|
||||
dev:
|
||||
host: '139.155.127.177'
|
||||
port: 30002
|
||||
password: gdxz2022&dj.
|
||||
database: 9
|
||||
prod:
|
||||
host: '139.155.127.177'
|
||||
port: 30002
|
||||
password: gdxz2022&dj.
|
||||
database: 10
|
||||
|
||||
|
||||
# MyBatis-Plus 配置
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 开启 SQL 日志
|
||||
map-underscore-to-camel-case: true
|
||||
mapper-locations: "classpath:mapper/*.xml"
|
||||
|
||||
# oss配置
|
||||
oss:
|
||||
access-key: LTAI5tKmFrVCghcxX7yHyGhm
|
||||
access-key-secret: q1aiIZCJJuf92YbKk2cSXnPES4zx26
|
||||
bucket: caseplatform
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
custom-domain-name: https://caseplatform.oss-cn-beijing.aliyuncs.com
|
||||
|
||||
# [阿里大鱼短信]
|
||||
dysms:
|
||||
access-key: LTAI4GGygjsKhyBwvvC3CghV
|
||||
access-secret: rcx7lO9kQxG10m8NqNPEfEtT9IS8EI
|
||||
|
||||
# jwt配置
|
||||
jwt:
|
||||
sign-key: 123456899 # 私钥
|
||||
ttl: 720 # 过期时间 小时
|
||||
algo: HS256 # 加密方式
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
level:
|
||||
root: info # 全局日志级别
|
||||
file:
|
||||
name: logs/app.log # 自定义日志文件路径
|
||||
pattern:
|
||||
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
|
||||
|
||||
# 微信
|
||||
wechat:
|
||||
miniapp:
|
||||
appid: wx152ad667d5075f27
|
||||
secret: 0b86e725d8f372fa05dad95a91d41c72
|
||||
|
||||
# [app]
|
||||
app:
|
||||
apiUrl: https://wx.igandan.com
|
||||
secretKey: nmBCF@hEK6eN&h03dYUin@AU3%bMf%$O
|
||||
imagePrefix: https://doc.igandan.com/app
|
||||
platform: case-storge
|
||||
platformPointAccount: GDXZadmin01
|
||||
access-token: XUUHml5iQ9mlFsa8QqOwyBrLI2nGGGxJ
|
||||
Loading…
x
Reference in New Issue
Block a user