chore: 添加部署文件

main
陈博文 2 weeks ago
parent c1fd528a6e
commit daa5e1226a

@ -0,0 +1,33 @@
const { execSync } = require('child_process');
const USER = 'root';
const HOST = '172.16.100.14';
const PORT = '24035';
const TARGET_DIR = '/home/gpustack-ui/dist';
const LOCAL_DIR = 'dist';
function run(cmd) {
console.log(`👉 ${cmd}`);
execSync(cmd, { stdio: 'inherit' });
}
try {
console.log('🚀 开始构建 React 项目...');
run('npm run build');
console.log('🧹 清理服务器旧 dist...');
run(`ssh -p ${PORT} ${USER}@${HOST} "rm -rf ${TARGET_DIR}"`);
console.log('📂 上传 dist 到服务器...');
run(`scp -P ${PORT} -r ${LOCAL_DIR} ${USER}@${HOST}:${TARGET_DIR}`);
console.log('🔧 执行服务器构建和服务重启...');
run(
`ssh -p ${PORT} ${USER}@${HOST} "cd /home/gpustack && make build && bash /home/gpustack-service/gpustack-reinstall.sh && bash /home/gpustack-service/gpustack-start.sh"`
);
console.log('✅ 部署完成!服务已重启。');
} catch (err) {
console.error('❌ 部署失败:', err.message);
process.exit(1);
}

@ -4,6 +4,7 @@
"scripts": {
"build": "max build",
"check:locales": "npx tsx ./src/locales/check.ts",
"deploy": "node ./deploy.js",
"dev": "max dev",
"format": "prettier --cache --write .",
"postinstall": "max setup",

Loading…
Cancel
Save