From 593e3156ed93fe786d90180cfc4b886b38dd0a6a Mon Sep 17 00:00:00 2001 From: AlexTan-b-z <572455105@qq.com> Date: Thu, 14 Nov 2024 13:24:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0builder=E7=9A=84docker?= =?UTF-8?q?=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使build也在容器内进行,本地无需部署maven环境 --- Dockerfile | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ca8a97198..9f12f8e21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,29 @@ +FROM maven:3.5.2-jdk-8-alpine as builder + +# 添加 Aliyun Maven 镜像 +RUN mkdir -p /root/.m2 +RUN echo ' \ + \ + \ + alimaven \ + aliyun maven \ + http://maven.aliyun.com/nexus/content/groups/public/ \ + central \ + \ + \ +' > /root/.m2/settings.xml +ENV MAVEN_CONFIG=/root/.m2 + +WORKDIR /kkFileView +COPY . . +RUN mvn clean package -DskipTests -Prelease + + FROM keking/kkfileview-base:4.4.0 -ADD server/target/kkFileView-*.tar.gz /opt/ +COPY --from=builder /kkFileView/server/target/kkFileView-*.tar.gz /opt/ +RUN tar -xzf /opt/kkFileView-*.tar.gz -C /opt && rm /opt/kkFileView-*.tar.gz ENV KKFILEVIEW_BIN_FOLDER=/opt/kkFileView-4.4.0-beta/bin ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-4.4.0-beta/config/application.properties","-jar","/opt/kkFileView-4.4.0-beta/bin/kkFileView-4.4.0-beta.jar"]