Commit 1a4ff1947fa6506841738303cdd59cd776b5cb16
1 parent
7582c814
feat: update脚本更新
Showing
1 changed file
with
26 additions
and
0 deletions
deploy/prod2.sh
0 → 100644
1 | +# 变量定义 | ||
2 | +$LAST_TAG = "1.0.6" | ||
3 | +$IMAGE_NAME = "canrud-outside-front" | ||
4 | +$TAG = "1.0.7" | ||
5 | +$TAR_FILE = "/web/canrud-outside-nuxt-front/${IMAGE_NAME}_${TAG}.tar" | ||
6 | + | ||
7 | + | ||
8 | +# 步骤1: 构建 Docker 镜像 | ||
9 | +Write-Output "Building Docker image..." | ||
10 | +docker build -t ${IMAGE_NAME}:${TAG} . | ||
11 | + | ||
12 | +# 步骤2: 将 Docker 镜像导出为 tar 文件 | ||
13 | +Write-Output "Saving Docker image to tar file..." | ||
14 | +docker save -o ${TAR_FILE} ${IMAGE_NAME}:${TAG} | ||
15 | + | ||
16 | +# 步骤3:加载镜像 | ||
17 | +docker load -i "$TAR_FILE" | ||
18 | + | ||
19 | +# 步骤4:删除当前运行的容器 | ||
20 | +docker stop "canrud-outside-front:${LAST_TAG}" | ||
21 | +docker rm "canrud-outside-front:${LAST_TAG}" | ||
22 | + | ||
23 | +# 步骤5:运行当前镜像 | ||
24 | +docker-compose up -d | ||
25 | + | ||
26 | +Write-Output "All tasks completed!" | ||
0 | \ No newline at end of file | 27 | \ No newline at end of file |