智慧水务管理系统 - 精河县供水工程综合管理平台

Dockerfile 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # ============================================================
  2. # Multi-stage Dockerfile for wm-base (核心基础服务)
  3. # Build: docker build -t water/wm-base --build-arg MODULE=wm-base .
  4. # ============================================================
  5. # ---------- Stage 1: Build ----------
  6. FROM maven:3.9-eclipse-temurin-17 AS builder
  7. WORKDIR /build
  8. # Copy parent POM and all module POMs first (dependency caching)
  9. COPY pom.xml ./
  10. COPY wm-common/pom.xml wm-common/
  11. COPY wm-gateway/pom.xml wm-gateway/
  12. COPY wm-base/pom.xml wm-base/
  13. COPY wm-iot/pom.xml wm-iot/
  14. COPY wm-data-engine/pom.xml wm-data-engine/
  15. COPY wm-bpm/pom.xml wm-bpm/
  16. COPY wm-bpm-engine/pom.xml wm-bpm-engine/
  17. COPY wm-production/pom.xml wm-production/
  18. COPY wm-revenue/pom.xml wm-revenue/
  19. COPY wm-patrol/pom.xml wm-patrol/
  20. COPY wm-bi/pom.xml wm-bi/
  21. COPY wm-notify/pom.xml wm-notify/
  22. COPY wm-job/pom.xml wm-job/
  23. COPY wm-dispatch/pom.xml wm-dispatch/
  24. COPY wm-system/pom.xml wm-system/
  25. COPY wm-mobile-app/pom.xml wm-mobile-app/
  26. COPY wm-config/pom.xml wm-config/
  27. COPY wm-dma/pom.xml wm-dma/
  28. # Download dependencies (cached layer)
  29. RUN mvn dependency:go-offline -B 2>/dev/null || true
  30. # Copy all source code
  31. COPY . .
  32. # Build the target module and its dependencies
  33. ARG MODULE=wm-base
  34. RUN mvn clean package -pl ${MODULE} -am -DskipTests -B
  35. # ---------- Stage 2: Runtime ----------
  36. FROM eclipse-temurin:17-jre-alpine
  37. LABEL maintainer="water-management-team"
  38. LABEL description="智慧水务管理系统 - 应用服务"
  39. RUN apk add --no-cache curl tzdata \
  40. && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
  41. && echo "Asia/Shanghai" > /etc/timezone
  42. WORKDIR /app
  43. ARG MODULE=wm-base
  44. ARG PORT=8081
  45. COPY --from=builder /build/${MODULE}/target/${MODULE}-*.jar app.jar
  46. EXPOSE ${PORT}
  47. # Health check
  48. HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
  49. CMD curl -sf http://localhost:${PORT}/actuator/health || exit 1
  50. ENTRYPOINT ["java", "-Xms256m", "-Xmx512m", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]