-
-
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
9b1a441
commit a2f70b1
Showing
1 changed file
with
8 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,18 +170,19 @@ docker save -o node22.tar node:22 | |
scp -P 2222 node22.tar [email protected]:/home/docker-images | ||
``` | ||
|
||
Pipeline 脚本中使用 Docker nodejs 20 运行示例 | ||
Pipeline 脚本中使用 Docker `nodejs 20` 运行示例 | ||
|
||
```groovy | ||
pipeline { | ||
//agent any | ||
// pipeline 放到 docker 中执行 | ||
agent { | ||
docker { | ||
// 使用 Node.js 18 的 Docker 镜像 | ||
image 'node:20' | ||
// 可选:挂载 NPM 缓存目录,加速构建 | ||
args '-v /root/.npm:/root/.npm' | ||
// 使用 Node.js 18 的 Docker 镜像 | ||
image 'node:20' | ||
// 可选:挂载 NPM 缓存目录,加速构建 | ||
// 使用 Jenkins 工作空间中的 .npm 目录作为缓存目录,不会有权限写入问题 | ||
args '-v ${JENKINS_HOME}/.npm:/home/node/.npm' | ||
} | ||
} | ||
environment { | ||
|
@@ -232,7 +233,7 @@ pipeline { | |
sh ''' | ||
ls -la | ||
cd h5_vip | ||
npm install --registry=https://registry.npmmirror.com/ | ||
npm install --cache /home/node/.npm --registry=https://registry.npmmirror.com/ | ||
ls -la | ||
npm run build | ||
ls -la | ||
|
@@ -319,7 +320,7 @@ scp -P 2222 my-openjdk-maven.3.8.7.tar [email protected]:/home/docker-images | |
docker load -i ./my-openjdk-maven.3.8.7.tar | ||
``` | ||
|
||
这事缓存下载的 maven 的包 | ||
缓存下载的 `maven` 的包 | ||
|
||
```sh | ||
docker run -it --rm my-openjdk-maven:3.8.7 /bin/bash | ||
|