提交 4c04c6a5 编写于 作者: ibizdev's avatar ibizdev

tony001 部署微服务应用 [TrainSys,网页端]

上级 584d1c32
MIT License
Copyright (c) 2023-present, iBiz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
/* eslint-disable import/newline-after-import */
import { readFileSync, writeFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { createRequire } from 'module';
// 获取当前模块的目录路径
const __dirname = dirname(fileURLToPath(import.meta.url));
// 创建 require 函数来读取 package.json
const require = createRequire(import.meta.url);
// 获取 package.json 中的版本号
const packageJson = require('../package.json');
const version = packageJson.version;
// 环境文件路径
const envFilePath = join(__dirname, '../public/environments/environment.js');
// 读取现有环境文件内容
let envFileContent;
try {
envFileContent = readFileSync(envFilePath, 'utf8');
} catch (err) {
console.error(`读取环境文件错误: ${err}`);
process.exit(1);
}
// 判断文件类型并处理
let updatedContent;
if (envFileContent.includes('appVersion:')) {
// 更新现有 appVersion
updatedContent = envFileContent.replace(
/appVersion:\s*['"][^'"]*['"]/,
`appVersion: '${version}'`,
);
} else {
// 添加 appVersion 到全局对象
updatedContent = envFileContent.replace(
/window\.Environment = \{/,
`window.Environment = {\n appVersion: '${version}',`,
);
}
// 写入更新后的内容
try {
writeFileSync(envFilePath, updatedContent, 'utf8');
console.log(`Successfully set appVersion to ${version}`);
} catch (err) {
console.error(`写入环境文件错误: ${err}`);
process.exit(1);
}
此差异已折叠。
import { defineGenerateDtsConfig } from '@ibiz-template/cli';
export default defineGenerateDtsConfig({
input: {
dirs: {
core: '/root/workspace/template/ibiz-template/packages/core/src/interface/api',
runtime:
'/root/workspace/template/ibiz-template/packages/runtime/src/interface/api',
},
},
replaceRules: {
'@ibiz-template/core': 'core',
},
output: {
target: 'all',
dir: 'dts',
fileName: 'types.d.ts',
},
});
...@@ -3,7 +3,7 @@ services: ...@@ -3,7 +3,7 @@ services:
trainsys-app-web: trainsys-app-web:
image: dstimage image: dstimage
ports: ports:
- "80:80" - "50100:80"
networks: networks:
- agent_network - agent_network
environment: environment:
......
...@@ -55,6 +55,15 @@ ...@@ -55,6 +55,15 @@
git clone -b master $para2 trainsys/ git clone -b master $para2 trainsys/
export NODE_OPTIONS=--max-old-space-size=4096 export NODE_OPTIONS=--max-old-space-size=4096
cd trainsys/ cd trainsys/
mkdir -p /var/lib/jenkins/appcache/A3064A91-F42D-4D7F-BC1C-4173A4F5772C
if [ -e app_Web/.dynamic ]
then
cd app_Web
else
cd app_Web/app
fi
sed -i "s#dstimage#registry.cn-shanghai.aliyuncs.com/ibizsys/ibizcloud-standardsys-app-webapp:2022.09.01.001#g" swarm.yaml
docker -H $para1 stack deploy --compose-file=swarm.yaml ebsx --with-registry-auth
</command> </command>
</hudson.tasks.Shell> </hudson.tasks.Shell>
</builders> </builders>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册