# 构建阶段
FROM maven:3.9-eclipse-temurin-17-alpine AS builder

WORKDIR /app

# 复制pom文件和源码
COPY pom.xml .
COPY ruoyi-admin ./ruoyi-admin
COPY ruoyi-common ./ruoyi-common
COPY ruoyi-extend ./ruoyi-extend
COPY ruoyi-modules ./ruoyi-modules

# 构建项目（跳过测试）
RUN mvn clean package -DskipTests -pl ruoyi-admin -am

# 运行阶段
FROM eclipse-temurin:17-jre-alpine

WORKDIR /app

# 复制构建产物
COPY --from=builder /app/ruoyi-admin/target/ruoyi-admin.jar app.jar

# 暴露端口
EXPOSE 6039

# 启动命令
ENTRYPOINT ["java", "-jar", "app.jar"]
