-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10c3d91
commit 997534c
Showing
3 changed files
with
183 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM --platform=linux/amd64 openjdk:11 | ||
|
||
# 安装 Maven 3.8.7 | ||
ENV MAVEN_VERSION=3.8.7 | ||
RUN apt-get update && apt-get install -y wget tar \ | ||
&& wget https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \ | ||
&& tar xzf apache-maven-${MAVEN_VERSION}-bin.tar.gz -C /opt \ | ||
&& ln -s /opt/apache-maven-${MAVEN_VERSION} /opt/maven \ | ||
&& rm apache-maven-${MAVEN_VERSION}-bin.tar.gz | ||
|
||
# 设置 Maven 环境变量 | ||
ENV MAVEN_HOME=/opt/maven | ||
ENV PATH="${MAVEN_HOME}/bin:${PATH}" | ||
|
||
# 创建非 root 用户并设置权限 | ||
RUN useradd -u 1000 -ms /bin/bash jenkins \ | ||
&& mkdir -p /home/jenkins/.m2/repository \ | ||
&& chown -R jenkins:jenkins /home/jenkins/.m2 | ||
|
||
# 切换到非 root 用户 | ||
USER jenkins | ||
|
||
# 验证 Maven 版本 | ||
RUN mvn -version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
[Java 环境镜像](../README.md#java-环境) |