Commit 6c04fa046c3a752655b491b6838bcfa792c94f1a
Merge branch 'master' into by
Showing
4 changed files
with
72 additions
and
7 deletions
deploy/prod2.sh
0 → 100644
1 | +#!/bin/bash | |
2 | +# 变量定义 | |
3 | +LAST_TAG="1.0.11" | |
4 | +TAG="1.0.12" | |
5 | +TARGET_PATH="/root/web/canrud-outside-nuxt-front" | |
6 | +DOCKERFILE_PATH="/root/web/canrud-outside-nuxt-front/canrud-nuxt-front" | |
7 | +IMAGE_NAME="canrud-outside-front" | |
8 | +TAR_FILE="${TARGET_PATH}/${IMAGE_NAME}_${TAG}.tar" | |
9 | +DOCKER_COMPOSE_FILE="${TARGET_PATH}/docker-compose.yml" | |
10 | + | |
11 | +# 定义错误处理函数 | |
12 | +handle_error() { | |
13 | + echo "Error occurred at step: $1. Exiting." | |
14 | + exit 1 | |
15 | +} | |
16 | + | |
17 | +# 步骤-1:修改 docker-compose.yml 文件 | |
18 | +echo "Updating docker-compose.yml file..." | |
19 | +cat > "$DOCKER_COMPOSE_FILE" <<EOL | |
20 | +version: '3.8' | |
21 | +services: | |
22 | + canrud-outside-front: | |
23 | + image: ${IMAGE_NAME}:${TAG} # 使用指定的镜像和标签 | |
24 | + container_name: canrud-outside-front | |
25 | + ports: | |
26 | + - "3000:3000" # 映射端口 | |
27 | + environment: | |
28 | + - BASE_URL=http://47.89.254.121:8002/shop | |
29 | + restart: unless-stopped # 如果容器退出,自动重启容器,除非是用户手动停止 | |
30 | +EOL | |
31 | + | |
32 | +# 检查文件是否已更新 | |
33 | +if [ $? -ne 0 ]; then | |
34 | + handle_error "Update docker-compose.yml" | |
35 | +fi | |
36 | + | |
37 | +# 步骤0:拉取代码 | |
38 | +echo "Pulling latest code..." | |
39 | +cd "${DOCKERFILE_PATH}" || handle_error "Change directory to ${DOCKERFILE_PATH}" | |
40 | +git pull || handle_error "Git pull" | |
41 | + | |
42 | +# 步骤1: 构建 Docker 镜像 | |
43 | +echo "Building Docker image..." | |
44 | +docker build -t ${IMAGE_NAME}:${TAG} . || handle_error "Docker build" | |
45 | + | |
46 | +# 步骤2: 将 Docker 镜像导出为 tar 文件 | |
47 | +echo "Saving Docker image to tar file..." | |
48 | +docker save -o ${TAR_FILE} ${IMAGE_NAME}:${TAG} || handle_error "Docker save" | |
49 | + | |
50 | +# 步骤3:加载镜像 | |
51 | +echo "Loading Docker image from tar file..." | |
52 | +docker load -i "$TAR_FILE" || handle_error "Docker load" | |
53 | + | |
54 | +# 步骤4:删除当前运行的容器 | |
55 | +echo "Stopping and removing the current container..." | |
56 | +docker stop canrud-outside-front || handle_error "Docker stop" | |
57 | +docker rm canrud-outside-front || handle_error "Docker rm" | |
58 | + | |
59 | +# 步骤5:运行当前镜像 | |
60 | +echo "Starting container with the new image..." | |
61 | +cd "${TARGET_PATH}" || handle_error "Change directory to ${TARGET_PATH}" | |
62 | +docker-compose up -d || handle_error "Docker-compose up" | |
63 | + | |
64 | +echo "All tasks completed successfully!" | |
65 | + | ... | ... |
nuxt.config.ts
... | ... | @@ -32,8 +32,8 @@ export default defineNuxtConfig({ |
32 | 32 | nitro: { |
33 | 33 | devProxy: { |
34 | 34 | "/shop": { |
35 | - // target: "http://47.89.254.121:8002/shop", // 线上代理地址 | |
36 | - target: "http://127.0.0.1:8002/shop/**", | |
35 | + target: "http://47.89.254.121:8002/shop", // 线上代理地址 | |
36 | + // target: "http://127.0.0.1:8002/shop/**", | |
37 | 37 | // target: process.env.BASE_URL || 'http://39.108.227.113:8002/shop', // 目标接口域名 |
38 | 38 | changeOrigin: true, // 表示是否跨域 |
39 | 39 | }, |
... | ... | @@ -41,8 +41,8 @@ export default defineNuxtConfig({ |
41 | 41 | // 该配置用于服务端请求转发 |
42 | 42 | routeRules: { |
43 | 43 | "/shop/**": { |
44 | - // proxy: "http://47.89.254.121:8002/shop/**", | |
45 | - proxy: "http://127.0.0.1:8002/shop/**", | |
44 | + proxy: "http://47.89.254.121:8002/shop/**", | |
45 | + // proxy: "http://127.0.0.1:8002/shop/**", | |
46 | 46 | // proxy: process.env.BASE_URL || 'http://39.108.227.113:8002/shop/**' |
47 | 47 | }, |
48 | 48 | }, | ... | ... |
pages/products/detail/[id]/index.vue
... | ... | @@ -33,7 +33,6 @@ let { data: resData } = await useAsyncData( |
33 | 33 | } |
34 | 34 | ); |
35 | 35 | watchEffect(() => { |
36 | - console.log(info.value, "5656infovalue2/resData.value.", resData.value); | |
37 | 36 | useHead({ |
38 | 37 | title: info.value.name || "canrud", |
39 | 38 | meta: [ |
... | ... | @@ -46,13 +45,13 @@ watchEffect(() => { |
46 | 45 | { |
47 | 46 | name: "keywords", |
48 | 47 | content: |
49 | - info.value.metakeywords || | |
48 | + info.value.name || | |
50 | 49 | "科路得,Equipment,High-precision,Machining center,Design,Manufacturing capabilities,Equipment supply,Production line planning,Construction services,Battery assembly lines,Pouch cell testing lines", |
51 | 50 | }, |
52 | 51 | { |
53 | 52 | name: "description", |
54 | 53 | content: |
55 | - info.value.metadescription || | |
54 | + info.value.name || | |
56 | 55 | "科路得,助您科研之路势在必得。Equipment Business: With our self-built high-precision machining center, we possess robust design and manufacturing capabilities. We offer comprehensive equipment supply, production line planning, and construction services, including battery assembly lines, pouch cell testing lines, and more. Our aim is to provide complete equipment solutions that cater to the diverse needs of our clients. Expect top-quality equipment and professional services that will help you stand out in a fiercely competitive market!", |
57 | 56 | }, |
58 | 57 | ], | ... | ... |