Skip to content

Commit

Permalink
fix(scripts): 优化deploy脚本,修复镜像构建异常
Browse files Browse the repository at this point in the history
  • Loading branch information
142vip.cn committed Oct 28, 2023
1 parent 1c8f54c commit 07f16f7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions scripts/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* - ./scripts/deploy ali
* - ./scripts/deploy github
*/
const { execShell } = require('./.exec')
const {execShell} = require('./.exec')
const packageVersion = require('../package.json').version

const dockerDeployInfo = {
Expand All @@ -31,8 +31,8 @@ const SupportScripts = {
cd -
`,
Ali: [
// 容器存在即删除
`
// 容器存在即删除
`
if docker inspect --format='{{.State.Running}}' ${dockerDeployInfo.containerName} >/dev/null 2>&1;then
docker rm -f ${dockerDeployInfo.containerName}
exit 0;
Expand All @@ -41,18 +41,18 @@ const SupportScripts = {
exit 1;
fi
`,
// 镜像存在即删除
`
if [[ "$(docker images -q ${imageName} 2> /dev/null)" != "" ]];then
// 镜像存在即删除
`
if [ "$(docker images -q ${imageName} 2> /dev/null)" != "" ];then
docker rmi ${imageName}
exit 0;
else
echo -e "镜像:${imageName},不存在"
exit 1;
fi
`,
// 运行容器
`
// 运行容器
`
docker run -d --name ${dockerDeployInfo.containerName} \
-p 7000:80 \
--network=${dockerDeployInfo.networkName} \
Expand Down Expand Up @@ -82,7 +82,7 @@ function getDeployCommand() {


// 执行
;(async() => {
;(async () => {
const deployCommand = getDeployCommand()
// console.log(deployCommand)
await execShell(deployCommand)
Expand Down

0 comments on commit 07f16f7

Please sign in to comment.