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

WORKDIR /app

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

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

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

WORKDIR /app

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

# 暴露端口
EXPOSE 6039

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