# 后端 Dockerfile
FROM maven:3.8.5-openjdk-8 AS build

# 设置工作目录
WORKDIR /app

# 复制 pom.xml 和源代码
COPY pom.xml .
COPY ruoyi-admin ./ruoyi-admin
COPY ruoyi-common ./ruoyi-common
COPY ruoyi-framework ./ruoyi-framework
COPY ruoyi-generator ./ruoyi-generator
COPY ruoyi-quartz ./ruoyi-quartz
COPY ruoyi-system ./ruoyi-system
COPY excel-handle ./excel-handle

# 构建项目
RUN mvn clean package -DskipTests

# 运行阶段
FROM openjdk:8-jre-slim

WORKDIR /app

# 复制构建好的 jar 包
COPY --from=build /app/ruoyi-admin/target/*.jar app.jar

# 创建上传目录
RUN mkdir -p /home/ruoyi/uploadPath

# 暴露端口
EXPOSE 8080

# 启动应用
ENTRYPOINT ["java", "-jar", "app.jar"]
