diff --git a/Dockerfile b/Dockerfile index 78e55d8..a8aace5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,20 @@ FROM maven:3.9-eclipse-temurin-21 AS build WORKDIR /build +# Maven Central 在国内网络下拉依赖不稳定(构建时曾出现 maven-filtering:3.3.1 解析失败), +# 构建阶段固定走阿里云 central 镜像;其它仓库仍直连。 +RUN mkdir -p /root/.m2 \ + && printf '%s\n' \ + '' \ + ' ' \ + ' ' \ + ' aliyun-central' \ + ' central' \ + ' https://maven.aliyun.com/repository/central' \ + ' ' \ + ' ' \ + '' > /root/.m2/settings.xml + # 先只拷各模块 pom 再拉依赖:依赖层可复用,改业务代码不会重新下载依赖 COPY pom.xml . COPY fruitshorts-common/pom.xml fruitshorts-common/ @@ -30,7 +44,7 @@ COPY fruitshorts-module-creator/pom.xml fruitshorts-module-creator/ COPY fruitshorts-admin-api/pom.xml fruitshorts-admin-api/ COPY fruitshorts-app-api/pom.xml fruitshorts-app-api/ COPY fruitshorts-transcode-worker/pom.xml fruitshorts-transcode-worker/ -RUN mvn -B -q -DskipTests dependency:go-offline || true +RUN mvn -B -q -DskipTests dependency:go-offline COPY . . ARG MODULE=fruitshorts-app-api