diff --git a/Dockerfile b/Dockerfile.dev similarity index 100% rename from Dockerfile rename to Dockerfile.dev diff --git a/Dockerfile.prod b/Dockerfile.prod new file mode 100644 index 0000000..2c93f2c --- /dev/null +++ b/Dockerfile.prod @@ -0,0 +1,50 @@ +# 第一阶段:使用 Maven + Java8 构建 JAR 包 +FROM maven:3.9.2-eclipse-temurin-8-alpine AS builder + +WORKDIR /app + +# 添加国内 Maven 镜像源 +RUN mkdir -p /root/.m2 && \ + echo ' \ + \ + \ + aliyun \ + * \ + aliyun maven \ + https://maven.aliyun.com/repository/public \ + \ + \ + ' > /root/.m2/settings.xml + +# 复制项目代码 +COPY pom.xml . +COPY sa-admin ./sa-admin +COPY sa-common ./sa-common + +# 构建项目 +RUN mvn clean package -Dmaven.test.skip=true -P prod + +# 第二阶段:使用更小的 Java8 JDK 镜像运行 +FROM eclipse-temurin:8-jdk-alpine + +WORKDIR /app + +# ✅ 安装字体 & libgcc 等依赖 +RUN apk add --no-cache \ + libstdc++ \ + libgcc \ + fontconfig \ + freetype \ + ttf-dejavu + +# 复制构建产物 +COPY --from=builder /app/sa-admin/target/*.jar app.jar + +# 暴露端口(请替换成你实际应用端口) +EXPOSE 5477 + +# 启动应用 +ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file diff --git a/sa-admin/src/main/resources/pre/application.yaml b/sa-admin/src/main/resources/pre/application.yaml index 5a05e58..e40e8ab 100644 --- a/sa-admin/src/main/resources/pre/application.yaml +++ b/sa-admin/src/main/resources/pre/application.yaml @@ -4,7 +4,7 @@ server: port: 7001 # tomcat 配置,主要用于 配置 访问日志(便于将来排查错误) tomcat: - basedir: ${localPath:/home}/logs/smart_admin_v2/pre/tomcat-logs + basedir: ./logs/smart_admin_v2/pre/tomcat-logs accesslog: enabled: true pattern: '%t %{X-Forwarded-For}i %a "%r" %s %D (%D ms)' @@ -12,6 +12,13 @@ server: spring: profiles: active: '@profiles.active@' + data: + redis: + host: '139.155.127.177' + port: 30002 + password: gdxz2022&dj. + database: 12 + timeout: 3000 # 项目配置 project: @@ -38,4 +45,26 @@ igandan: token: zd8V2LYD4achjFZrbHgD2PuzKuthDCVx platform: case doc: - host: https://doc.igandan.com/app/ \ No newline at end of file + host: https://doc.igandan.com/app/ + +fxq: + client-id: Md7w4eaZih + client-secret: 97acf8ebb09641cbb90accf06e74ccf5 + client-url: https://saasapi.fangxinqian.cn/openapi/v2/ + +baiduce: + app-id: 119377580 + app-key: 2YFRnP3ryU8IP0IqbqybTu6u + app-secret: Zw8pTeM1ovys7kOsNUlElOc6jBi6zsFU + +# json序列化相关配置 +jackson: + serialization: + write-enums-using-to-string: true + write-dates-as-timestamps: false + deserialization: + read-enums-using-to-string: true + fail-on-unknown-properties: false + default-property-inclusion: always + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 \ No newline at end of file diff --git a/sa-admin/src/main/resources/pre/log4j2.xml b/sa-admin/src/main/resources/pre/log4j2.xml index 70c3f92..f51e923 100644 --- a/sa-admin/src/main/resources/pre/log4j2.xml +++ b/sa-admin/src/main/resources/pre/log4j2.xml @@ -5,7 +5,7 @@ --> - $${env:localPath:-/home}/logs/smart_admin_v2/pre + ./logs/smart_admin_v2/pre diff --git a/sa-admin/src/main/resources/pre/spy.properties b/sa-admin/src/main/resources/pre/spy.properties new file mode 100644 index 0000000..9877f62 --- /dev/null +++ b/sa-admin/src/main/resources/pre/spy.properties @@ -0,0 +1,18 @@ +#相关的包 +modulelist=com.baomidou.mybatisplus.extension.p6spy.MybatisPlusLogFactory,com.p6spy.engine.outage.P6OutageFactory +# 日志格式 +logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger +#日志输出到控制台 +appender=com.p6spy.engine.spy.appender.StdoutLogger +# 设置 p6spy driver 代理 +deregisterdrivers=true +# 取消JDBC URL前缀 +useprefix=true +# 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset. +excludecategories=info,debug,result,commit,resultset +# 日期格式 +dateformat=yyyy-MM-dd HH:mm:ss +# 开启慢sql +outagedetection=true +# 慢SQL记录标准(单位秒) +outagedetectioninterval=2 \ No newline at end of file diff --git a/sa-admin/src/main/resources/prod/application.yaml b/sa-admin/src/main/resources/prod/application.yaml index 338ca5c..7ff0533 100644 --- a/sa-admin/src/main/resources/prod/application.yaml +++ b/sa-admin/src/main/resources/prod/application.yaml @@ -6,6 +6,13 @@ server: spring: profiles: active: '@profiles.active@' + data: + redis: + host: '139.155.127.177' + port: 30002 + password: gdxz2022&dj. + database: 12 + timeout: 3000 # 项目配置 project: @@ -32,4 +39,26 @@ igandan: token: zd8V2LYD4achjFZrbHgD2PuzKuthDCVx platform: case doc: - host: https://doc.igandan.com/app/ \ No newline at end of file + host: https://doc.igandan.com/app/ + +fxq: + client-id: Md7w4eaZih + client-secret: 97acf8ebb09641cbb90accf06e74ccf5 + client-url: https://saasapi.fangxinqian.cn/openapi/v2/ + +baiduce: + app-id: 119377580 + app-key: 2YFRnP3ryU8IP0IqbqybTu6u + app-secret: Zw8pTeM1ovys7kOsNUlElOc6jBi6zsFU + +# json序列化相关配置 +jackson: + serialization: + write-enums-using-to-string: true + write-dates-as-timestamps: false + deserialization: + read-enums-using-to-string: true + fail-on-unknown-properties: false + default-property-inclusion: always + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 \ No newline at end of file diff --git a/sa-admin/src/main/resources/prod/log4j2.xml b/sa-admin/src/main/resources/prod/log4j2.xml index 2d87334..63d9a98 100644 --- a/sa-admin/src/main/resources/prod/log4j2.xml +++ b/sa-admin/src/main/resources/prod/log4j2.xml @@ -5,7 +5,7 @@ --> - /web/medical-case/logs/case_admin/prod + ./logs/smart_admin_v2/prod diff --git a/sa-admin/src/main/resources/prod/spy.properties b/sa-admin/src/main/resources/prod/spy.properties new file mode 100644 index 0000000..9877f62 --- /dev/null +++ b/sa-admin/src/main/resources/prod/spy.properties @@ -0,0 +1,18 @@ +#相关的包 +modulelist=com.baomidou.mybatisplus.extension.p6spy.MybatisPlusLogFactory,com.p6spy.engine.outage.P6OutageFactory +# 日志格式 +logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger +#日志输出到控制台 +appender=com.p6spy.engine.spy.appender.StdoutLogger +# 设置 p6spy driver 代理 +deregisterdrivers=true +# 取消JDBC URL前缀 +useprefix=true +# 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset. +excludecategories=info,debug,result,commit,resultset +# 日期格式 +dateformat=yyyy-MM-dd HH:mm:ss +# 开启慢sql +outagedetection=true +# 慢SQL记录标准(单位秒) +outagedetectioninterval=2 \ No newline at end of file