# ================================================
# Urban Lifeline - All-in-One 后端服务镜像
# 单容器运行所有微服务，通过脚本管理
# 
# 构建: docker build -t urban-lifeline-serv:latest -f Dockerfile.serv .
# ================================================
FROM urban-lifeline-base-serv:latest

WORKDIR /app
RUN mkdir -p /app/jars /app/logs /app/pids /app/config

# 复制管理脚本
COPY docker/urbanLifeline/serv/service-manager.sh /app/service-manager.sh
RUN chmod +x /app/service-manager.sh

# 复制所有服务 JAR 包
COPY urbanLifelineServ/gateway/target/*.jar /app/jars/gateway.jar
COPY urbanLifelineServ/system/target/*.jar /app/jars/system.jar
COPY urbanLifelineServ/auth/target/*.jar /app/jars/auth.jar
COPY urbanLifelineServ/file/target/*.jar /app/jars/file.jar
COPY urbanLifelineServ/ai/target/*.jar /app/jars/ai.jar
COPY urbanLifelineServ/workcase/target/*.jar /app/jars/workcase.jar

# # COPY urbanLifelineServ/log/target/*.jar /app/jars/log.jar
# COPY urbanLifelineServ/message/target/*.jar /app/jars/message.jar
# COPY urbanLifelineServ/crontab/target/*.jar /app/jars/crontab.jar
# COPY urbanLifelineServ/bidding/target/*.jar /app/jars/bidding.jar
# COPY urbanLifelineServ/platform/target/*.jar /app/jars/platform.jar

# 配置目录 (可外挂)
VOLUME ["/app/config", "/app/logs"]

EXPOSE 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090

HEALTHCHECK --interval=30s --timeout=10s --start-period=180s --retries=3 \
    CMD curl -f http://localhost:8080/actuator/health || exit 1

ENTRYPOINT ["/app/service-manager.sh"]
CMD ["start-all"]
