Refactor project structure and update Maven configuration for CRM service

This commit is contained in:
bigtian 2025-06-26 15:59:05 +08:00
parent 23fda37512
commit 7e6fa6c3eb
4 changed files with 31 additions and 56 deletions

View File

@ -1,25 +0,0 @@
# 备用 Dockerfile - 使用 Eclipse Temurin JDK
FROM eclipse-temurin:17-jre-alpine
# 设置时区和安装必要工具
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo 'Asia/Shanghai' >/etc/timezone && \
apk add --no-cache curl
# 复制 jar 包
COPY ./target/crm-mcp-*.jar /app/crm-mcp.jar
# 设置工作目录
WORKDIR /app
# 暴露端口
EXPOSE 8080
# 设置 JVM 参数和启动命令
CMD ["java", \
"-Xms512m", \
"-Xmx1024m", \
"-Dspring.profiles.active=dev", \
"-Dspring.ai.mcp.server.stdio=false", \
"-jar", \
"crm-mcp.jar"]

View File

@ -1,20 +0,0 @@
# 最简单的 Dockerfile不安装额外工具
FROM docker.xuanyuan.me/openjdk:17
# 复制 jar 包
COPY ./target/crm-mcp-*.jar /app/crm-mcp.jar
# 设置工作目录
WORKDIR /app
# 暴露端口
EXPOSE 8080
# 设置 JVM 参数和启动命令
CMD ["java", \
"-Xms512m", \
"-Xmx1024m", \
"-Dspring.profiles.active=dev", \
"-Dspring.ai.mcp.server.stdio=false", \
"-jar", \
"crm-mcp.jar"]

View File

@ -54,15 +54,35 @@ maven_build() {
docker_build() { docker_build() {
print_message "开始 Docker 构建..." print_message "开始 Docker 构建..."
if [ "$USE_DOCKER_BUILD" = true ]; then # 按优先级尝试不同的 Dockerfile
# 使用多阶段构建 DOCKERFILES=(
docker build -t crm-mcp:latest . "Dockerfile_simple:最简单版本(推荐)"
else "Dockerfile_alpine:使用Alpine+OpenJDK17"
# 使用测试 Dockerfile需要先有 jar 包) "Dockerfile_test:智能检测系统类型"
docker build -f Dockerfile_test -t crm-mcp:latest . "Dockerfile_corretto:使用Amazon Corretto"
fi "Dockerfile_backup:备用方案"
)
print_message "Docker 构建完成" for dockerfile_info in "${DOCKERFILES[@]}"; do
dockerfile=$(echo "$dockerfile_info" | cut -d':' -f1)
description=$(echo "$dockerfile_info" | cut -d':' -f2)
if [ -f "$dockerfile" ]; then
print_message "尝试使用 $dockerfile ($description)..."
if docker build -f "$dockerfile" -t crm-mcp:latest . --network=host; then
print_message "✅ 使用 $dockerfile 构建成功!"
return 0
else
print_warning "❌ 使用 $dockerfile 构建失败,尝试下一个..."
sleep 2
fi
fi
done
print_error "所有 Dockerfile 构建都失败了"
print_message "请检查网络连接或尝试配置 Docker 镜像源"
exit 1
} }
# 启动服务 # 启动服务

View File

@ -4,7 +4,7 @@ crm:
token: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJJUXdrczhuUWc4NnJPQkpuenJDUThtbjl1N3FEQ2lWZyJ9.91GO7OMhVbc0tLBRZ7HYiFDEA92PXE7H1gHduwxWu2I token: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJJUXdrczhuUWc4NnJPQkpuenJDUThtbjl1N3FEQ2lWZyJ9.91GO7OMhVbc0tLBRZ7HYiFDEA92PXE7H1gHduwxWu2I
server: server:
servlet: servlet:
context-path: crm-mcp context-path: /crm-mcp
spring: spring:
main: main: