增加构建环境

This commit is contained in:
2025-07-18 12:46:22 +08:00
parent 20cd03a96a
commit 8f32e19115
2 changed files with 20 additions and 1 deletions

13
Dockerfile.buildagent Normal file
View File

@ -0,0 +1,13 @@
# 使用 JDK 8 作为构建环境
FROM openjdk:8-jdk
# 安装 Maven
RUN apt update && \
apt install -y maven && \
mvn --version
# 安装 Git用于代码拉取
RUN apt install -y git
# 设置工作目录
WORKDIR /home/jenkins/workspace

8
Jenkinsfile vendored
View File

@ -1,5 +1,11 @@
pipeline { pipeline {
agent any agent {
dockerfile {
// 使用当前目录下的 Dockerfile.buildagent
filename "Dockerfile.buildagent"
// 可选:构建时添加标签
label "maven-jdk8"
}
tools { tools {
maven 'M3' // 必须在 Jenkins → Manage Jenkins → Global Tool Configuration 中配置过 maven 'M3' // 必须在 Jenkins → Manage Jenkins → Global Tool Configuration 中配置过
} }