更换容器运行后,调整所对应的文件路径
This commit is contained in:
@@ -9,13 +9,13 @@ module.exports = {
|
|||||||
dbUtils.query(sql).then(res => {
|
dbUtils.query(sql).then(res => {
|
||||||
let info = res?.[0]
|
let info = res?.[0]
|
||||||
if (info?.id) {
|
if (info?.id) {
|
||||||
let path = `${info.target}`, zipPath = `/home/deploy/node-service/zips/${info.id}.zip`
|
let path = `${info.target}`, zipPath = `/zips/${info.id}.zip`
|
||||||
fse.removeSync(zipPath)
|
fse.removeSync(zipPath)
|
||||||
fse.pathExists(path, (err, exists) => {
|
fse.pathExists(path, (err, exists) => {
|
||||||
console.log(`${path}=========>${exists}`)
|
console.log(`${path}=========>${exists}`)
|
||||||
if (exists) {
|
if (exists) {
|
||||||
execute(`cd ${path}&&zip -r ${info.id}.zip .`)
|
execute(`cd ${path}&&zip -r ${info.id}.zip .`)
|
||||||
.then(() => execute(`cd ${path}&&mv ${info.id}.zip /home/deploy/node-service/zips`))
|
.then(() => execute(`cd ${path}&&mv ${info.id}.zip /zips`))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('压缩完成!')
|
console.log('压缩完成!')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ module.exports = {
|
|||||||
let id = request.query?.id
|
let id = request.query?.id
|
||||||
dbUtils.detail({table: 'node_custom_config', id}).then(info => {
|
dbUtils.detail({table: 'node_custom_config', id}).then(info => {
|
||||||
if (info?.id) {
|
if (info?.id) {
|
||||||
let path = `${info.dist || `../zips/${info.name}v${info.version}`}`, zipPath = `../zips/${info.id}.zip`
|
let path = `${info.dist || `/zips/${info.name}v${info.version}`}`, zipPath = `/zips/${info.id}.zip`
|
||||||
fse.removeSync(zipPath)
|
fse.removeSync(zipPath)
|
||||||
fse.pathExists(path, (err, exists) => {
|
fse.pathExists(path, (err, exists) => {
|
||||||
console.log(`${path}=========>${exists}`)
|
console.log(`${path}=========>${exists}`)
|
||||||
if (exists) {
|
if (exists) {
|
||||||
execute(`cd ${path}&&zip -r ${info.id}.zip .`)
|
execute(`cd ${path}&&zip -r ${info.id}.zip .`)
|
||||||
.then(() => execute(`cd ${path}&&mv ${info.id}.zip /home/deploy/node_deploy/zips/`))
|
.then(() => execute(`cd ${path}&&mv ${info.id}.zip /zips/`))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('压缩完成!')
|
console.log('压缩完成!')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ module.exports = {
|
|||||||
execute: (request, response) => {
|
execute: (request, response) => {
|
||||||
let {id} = request.query
|
let {id} = request.query
|
||||||
if (id) {
|
if (id) {
|
||||||
let path = `/home/deploy/node_deploy/zips/${id}/`, zipPath = `/home/deploy/node_deploy/zips/${id}.zip`
|
let path = `/zips/${id}/`, zipPath = `/zips/${id}.zip`
|
||||||
fse.removeSync(zipPath)
|
fse.removeSync(zipPath)
|
||||||
fse.pathExists(path, (err, exists) => {
|
fse.pathExists(path, (err, exists) => {
|
||||||
console.log(`${path}=========>${exists}`)
|
console.log(`${path}=========>${exists}`)
|
||||||
if (exists) {
|
if (exists) {
|
||||||
execute(`cd ${path}&&zip -r ${id}.zip .`)
|
execute(`cd ${path}&&zip -r ${id}.zip .`)
|
||||||
.then(() => execute(`cd ${path}&&mv ${id}.zip /home/deploy/node_deploy/zips`))
|
.then(() => execute(`cd ${path}&&mv ${id}.zip /zips`))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('压缩完成!')
|
console.log('压缩完成!')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ module.exports = {
|
|||||||
db.query(sql).then(() => setTimeout(() => {
|
db.query(sql).then(() => setTimeout(() => {
|
||||||
response.send({code: 0})
|
response.send({code: 0})
|
||||||
}, 2000))
|
}, 2000))
|
||||||
const path = info.projectPath || (isDev ? 'E:\\code\\cunwei\\dvcp_v2_wechat' : '/home/deploy/node_deploy/dvcp_v2_wechat'),
|
const path = info.projectPath || (isDev ? 'E:\\code\\cunwei\\dvcp_v2_wechat' : '/dvcp_v2_wechat'),
|
||||||
dest = (isDev ? `E:\\wxmpZips\\${id}` : `/home/deploy/node_deploy/zips/${id}/`),
|
dest = (isDev ? `E:\\wxmpZips\\${id}` : `/zips/${id}/`),
|
||||||
processEnv = info.npmScript || 'build',
|
processEnv = info.npmScript || 'build',
|
||||||
dist = info.npmScript ? `${path}/dist/${info.npmScript}/` : `${path}/dist/build/mp-weixin/`
|
dist = info.npmScript ? `${path}/dist/${info.npmScript}/` : `${path}/dist/build/mp-weixin/`
|
||||||
execute(`cd ${path}&&npm run apps&&node bin/pages.js ${appid} ${id}&&npm run ${processEnv}`)
|
execute(`cd ${path}&&npm run apps&&node bin/pages.js ${appid} ${id}&&npm run ${processEnv}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user