diff --git a/Dockerfile b/Dockerfile index 050564c..26819f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,11 @@ -# ========== 阶段一:Maven 构建 ========== -FROM eclipse-temurin:8-jdk-alpine AS builder +# ========== 阶段一:Maven 构建(使用带 Maven 的镜像 + 国内源) ========== +FROM maven:3.9-eclipse-temurin-8-alpine AS builder WORKDIR /build +# 使用阿里云 Maven 镜像,加速依赖下载 +COPY docker/maven-settings.xml /root/.m2/settings.xml + # 先只复制 pom,利用 Docker 缓存依赖层 COPY pom.xml . RUN mvn dependency:go-offline -B -q diff --git a/docker/maven-settings.xml b/docker/maven-settings.xml new file mode 100644 index 0000000..856e97d --- /dev/null +++ b/docker/maven-settings.xml @@ -0,0 +1,49 @@ + + + + + aliyun-public + * + 阿里云公共仓库 + https://maven.aliyun.com/repository/public + + + + + aliyun + + + aliyun-public + https://maven.aliyun.com/repository/public + true + true + + + aliyun-central + https://maven.aliyun.com/repository/central + true + false + + + aliyun-spring + https://maven.aliyun.com/repository/spring + true + false + + + + + aliyun-public + https://maven.aliyun.com/repository/public + true + true + + + + + + aliyun + +