62 lines
2.6 KiB
Docker
62 lines
2.6 KiB
Docker
# 多阶段构建 - 出库服务
|
|
FROM maven:3.9-eclipse-temurin-17 AS builder
|
|
|
|
LABEL maintainer="cpte@163.com"
|
|
LABEL description="CPTE WMS Outbound Service"
|
|
|
|
WORKDIR /app
|
|
|
|
# 复制 pom.xml 并下载依赖
|
|
COPY cpte-boot-base-core/pom.xml ./cpte-boot-base-core/
|
|
COPY cpte-module-system/pom.xml ./cpte-module-system/
|
|
COPY cpte-module-system/cpte-system-api/pom.xml ./cpte-module-system/cpte-system-api/
|
|
COPY cpte-module-system/cpte-system-api/cpte-system-local-api/pom.xml ./cpte-module-system/cpte-system-api/cpte-system-local-api/
|
|
COPY cpte-module-system/cpte-system-biz/pom.xml ./cpte-module-system/cpte-system-biz/
|
|
COPY cpte-boot-module/pom.xml ./cpte-boot-module/
|
|
COPY cpte-boot-module/cpte-module-wms/pom.xml ./cpte-boot-module/cpte-module-wms/
|
|
COPY cpte-wms-service/pom.xml ./cpte-wms-service/
|
|
COPY cpte-wms-service/cpte-wms-api/pom.xml ./cpte-wms-service/cpte-wms-api/
|
|
COPY cpte-wms-service/cpte-wms-outbound-service/pom.xml ./cpte-wms-service/cpte-wms-outbound-service/
|
|
COPY pom.xml ./
|
|
|
|
# 下载依赖
|
|
RUN mvn dependency:go-offline -B
|
|
|
|
# 复制源代码并构建
|
|
COPY cpte-boot-base-core/src ./cpte-boot-base-core/src
|
|
COPY cpte-module-system/cpte-system-api/src ./cpte-module-system/cpte-system-api/src
|
|
COPY cpte-module-system/cpte-system-api/cpte-system-local-api/src ./cpte-module-system/cpte-system-api/cpte-system-local-api/src
|
|
COPY cpte-module-system/cpte-system-biz/src ./cpte-module-system/cpte-system-biz/src
|
|
COPY cpte-boot-module/cpte-module-wms/src ./cpte-boot-module/cpte-module-wms/src
|
|
COPY cpte-wms-service/cpte-wms-api/src ./cpte-wms-service/cpte-wms-api/src
|
|
COPY cpte-wms-service/cpte-wms-outbound-service/src ./cpte-wms-service/cpte-wms-outbound-service/src
|
|
|
|
RUN mvn clean package -DskipTests -pl cpte-wms-service/cpte-wms-outbound-service -am -B
|
|
|
|
# 运行阶段
|
|
FROM eclipse-temurin:17-jre-alpine
|
|
|
|
LABEL maintainer="cpte@163.com"
|
|
LABEL description="CPTE WMS Outbound Service Runtime"
|
|
|
|
RUN apk add --no-cache curl tzdata busybox-extras \
|
|
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
|
&& echo "Asia/Shanghai" > /etc/timezone
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/cpte-wms-service/cpte-wms-outbound-service/target/*.jar app.jar
|
|
|
|
RUN mkdir -p /data/upload /data/webapp /data/logs
|
|
|
|
ENV JAVA_OPTS="-Xms512m -Xmx1g -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/logs"
|
|
ENV SPRING_PROFILES_ACTIVE="k8s"
|
|
ENV TZ="Asia/Shanghai"
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
|
|
CMD curl -f http://localhost:8080/actuator/health || exit 1
|
|
|
|
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -Dspring.profiles.active=$SPRING_PROFILES_ACTIVE -jar app.jar"]
|