feat(alert): 新增模型配置与版本管理功能 #46
Merged
chenjiale
merged 1 commits from cjl-dev into master 1 month ago
8 changed files with 76 additions and 2 deletions
@ -0,0 +1,27 @@ |
|||
## 使用 JRE 运行,避免在镜像中重新构建 Jar |
|||
FROM docker.io/eclipse-temurin:21-jre |
|||
|
|||
## 允许在构建时传入已编译好的 Jar 路径与外部挂载的配置目录 |
|||
ARG JAR_PATH=/opt/alert/alert-backend/app.jar |
|||
ARG CONFIG_DIR=/opt/alert/alert-backend |
|||
|
|||
WORKDIR /yudao-server |
|||
|
|||
## 配置目录来自宿主机挂载,不在镜像内再生成 |
|||
ENV CONFIG_DIR=${CONFIG_DIR} |
|||
RUN mkdir -p ${CONFIG_DIR} |
|||
VOLUME ${CONFIG_DIR} |
|||
|
|||
## 拷贝已有的可执行 Jar |
|||
COPY ${JAR_PATH} app.jar |
|||
|
|||
## 基础运行时配置 |
|||
ENV TZ=Asia/Shanghai |
|||
ENV JAVA_OPTS="-Xms512m -Xmx512m -Djava.security.egd=file:/dev/./urandom" |
|||
ENV ARGS="" |
|||
ENV SPRING_CONFIG_ADDITIONAL_LOCATION=file:${CONFIG_DIR}/ |
|||
ENV LOGGING_CONFIG=${CONFIG_DIR}/logback-spring.xml |
|||
|
|||
EXPOSE 48080 |
|||
|
|||
CMD java ${JAVA_OPTS} -Dlogging.config=${LOGGING_CONFIG} -jar /yudao-server/app.jar --spring.config.additional-location=${SPRING_CONFIG_ADDITIONAL_LOCATION} $ARGS |
|||
@ -0,0 +1,37 @@ |
|||
package cn.iocoder.yudao.framework.common.util.json.databind; |
|||
|
|||
import com.fasterxml.jackson.core.JsonParser; |
|||
import com.fasterxml.jackson.databind.DeserializationContext; |
|||
import com.fasterxml.jackson.databind.JsonDeserializer; |
|||
|
|||
import java.io.IOException; |
|||
import java.text.ParseException; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Arrays; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2025-12-08 19:52 |
|||
*/ |
|||
public class MultiDateDeserializer extends JsonDeserializer<Date> { |
|||
|
|||
private static final List<String> FORMATS = Arrays.asList( |
|||
"yyyy-MM-dd HH:mm:ss", |
|||
"yyyy/MM/dd HH:mm:ss" |
|||
); |
|||
|
|||
@Override |
|||
public Date deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { |
|||
String text = p.getText().trim(); |
|||
for (String format : FORMATS) { |
|||
try { |
|||
return new SimpleDateFormat(format).parse(text); |
|||
} catch (ParseException ignored) { |
|||
} |
|||
} |
|||
throw new RuntimeException("Unsupported date format: " + text); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue