This commit is contained in:
wenyongda 2025-07-24 19:08:36 +08:00
parent f02b6bace7
commit 86199f6190
3 changed files with 262 additions and 0 deletions

View File

@ -257,3 +257,175 @@ docker images
docker run --name xiaodaerpnetcore -p 7274:80 -d xiaodaerp/netcore docker run --name xiaodaerpnetcore -p 7274:80 -d xiaodaerp/netcore
``` ```
# Jenkins环境配置
## Docker容器内安装NVM
首先以bash命令行交互形式进入容器
```shell
docker exec -it jenkins /bin/bash
```
下载并执行nvm-sh脚本
```shell
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
```
执行完成,需应用环境变量
```shell
source ~/.bashrc
```
全局安装pnpm
```shell
npm install -g pnpm
```
设置源
```shell
pnpm config set registry https://registry.npmmirror.com
```
查看nodejs位置
```shell
npm prefix -g
```
## Docker容器内安装JDK
首先下载好需要的jdk包
复制到容器内用户目录下
```shell
docker cp docker cp ~/OpenJDK21U-jdk_aarch64_linux_hotspot_21.0.8_9.tar.gz jenkins:/root
```
以交互模式进入到容器内
```shell
docker exec -it jenkins /bin/bash
```
解压压缩包
```shell
cd ~
tar -zxvf OpenJDK21U-jdk_aarch64_linux_hotspot_21.0.8_9.tar.gz
```
# Jenkins Pipeline流水线
```shell
pipeline {
agent any
tools {
nodejs 'NodeJS 22.17.0'
}
environment {
GIT_URL = 'http://192.168.6.20:9980/line-group/dify-conversation.git'
BRANCH_NAME = 'erp-conversation'
}
stages {
stage('Preparation') {
steps {
// 清理工作空间
// deleteDir()
// 拉取代码
git branch: "${BRANCH_NAME}",
url: "${GIT_URL}",
credentialsId: '118322d7-1666-4f0b-b48b-349dcead864c',
changelog: true,
poll: false
}
}
stage('Setup Environment') {
steps {
sh '''
node --version
pnpm --version
'''
}
}
stage('Intall Dependencies') {
steps {
sh '''
# 清理缓存
pnpm store prune || true
# 安装依赖
pnpm install --frozen-lockfile
# 检查依赖
pnpm list --depth 0
'''
}
}
stage('Build Production') {
steps {
sh '''
# 清理旧构建
rm -rf .next || true
# 生产环境构建
pnpm run build
# 验证构建结果
if [ -d ".next" ]; then
echo "构建成功,文件列表:"
ls -la .next/
echo "总文件数:$(find dist -type f | wc -l)"
else
echo "构建失败,.next目录不存在"
exit 1
fi
'''
}
post {
success {
archiveArtifacts artifacts: '.next/**/*', fingerprint: true
}
}
}
stage('Quality Check') {
steps {
sh '''
# 代码检查
pnpm run lint --no-fix || echo "代码检查完成"
# 类型检查
pnpm run type-check || echo "类型检查完成"
'''
}
}
}
post {
cleanup {
cleanWs()
}
success {
echo 'Pipeline completed successfully!'
}
failure {
echo 'Pipeline failed!'
}
}
}
```

View File

@ -1902,6 +1902,51 @@ rimraf node_modules
# NVM
> nvmNode Version Manager是一个非常有用的工具可以让您在同一台机器上安装和管理多个 Node.js 版本。
>
> [nvm-sh/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions (github.com)](https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating)
**nvm 常用命令:**
```shell
# 查看 nvm 版本
nvm --version
# 列出所有可安装的 Node.js 版本
nvm list-remote
# Windows 上使用
nvm list available
# 安装最新的 LTS 版本
nvm install --lts
# 安装特定版本
nvm install 18.17.0
nvm install 16.20.1
# 列出已安装的版本
nvm list
# 或
nvm ls
# 切换到特定版本
nvm use 18.17.0
# 设置默认版本
nvm alias default 18.17.0
# 查看当前使用的版本
nvm current
# 卸载特定版本
nvm uninstall 16.20.1
# 查看当前使用的npm的目录
npm prefix -g
```
# npx # npx
npm大家都知道是node的包管理器npx虽然也见过但似乎较少用过那npx到底是什么呢 npm大家都知道是node的包管理器npx虽然也见过但似乎较少用过那npx到底是什么呢

View File

@ -26,3 +26,48 @@ C:\Program Files\dotnet\sdk\9.0.302\Sdks\Microsoft.NET.Sdk.Publish\targets\Publi
之后打开服务找到Web 部署代理服务,重新启动一下 之后打开服务找到Web 部署代理服务,重新启动一下
![image-20250721111012495](D:\source\repos\XiaodaBlogSource\source\_posts\Windows-Server\image-20250721111012495.png) ![image-20250721111012495](D:\source\repos\XiaodaBlogSource\source\_posts\Windows-Server\image-20250721111012495.png)
# Windows 运行命令
## 进入Windows 设置
```cmd
ms-settings:
```
## 远程桌面连接
```cmd
mstsc
```
### 本地组策略编辑器
```cmd
gpedit.msc
```
## 服务
```cmd
services.msc
```
## 设备管理器
```cmd
devmgmt.msc
```
## 控制面板
```cmd
control
```
## 注册表编辑器
```cmd
regedit
```