FROM maven:3.8-openjdk-8 AS builder
WORKDIR /src
COPY backend/xiaoqu-intellectual-public/ xiaoqu-intellectual-public/
COPY backend/xiaoqu-intellectual-task/ xiaoqu-intellectual-task/
RUN cd xiaoqu-intellectual-public && mvn clean install -q -DskipTests \
 && cd ../xiaoqu-intellectual-task && mvn clean package -q -DskipTests

FROM openjdk:8-jre-slim
WORKDIR /app
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
 && mkdir -p /app/config /app/logs
COPY --from=builder /src/xiaoqu-intellectual-task/target/*.jar app.jar
EXPOSE 8097
ENTRYPOINT ["java", "-jar", "app.jar", \
  "--spring.config.additional-location=/app/config/"]
