From 0b8390cae69777be4405b5d9128dcf7f3f9718ec Mon Sep 17 00:00:00 2001 From: SwTt29 <2055018491@qq.com> Date: Tue, 30 Dec 2025 10:52:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9A=E4=BD=BF=E7=94=A8=E5=9B=BD=E5=86=85?= =?UTF-8?q?Docker=E9=95=9C=E5=83=8F=E6=BA=90=E5=8A=A0=E9=80=9F=E5=92=8C?= =?UTF-8?q?=E9=98=BF=E9=87=8C=E4=BA=91Node=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 ++-- deploy.sh | 48 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 93e07ec..1b508a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -# 使用官方的Node.js 18镜像作为基础镜像 -FROM node:18-alpine +# 使用国内阿里云的Node.js 18镜像作为基础镜像 +FROM registry.cn-hangzhou.aliyuncs.com/library/node:18-alpine # 设置工作目录 WORKDIR /app diff --git a/deploy.sh b/deploy.sh index df84373..f11b740 100644 --- a/deploy.sh +++ b/deploy.sh @@ -5,11 +5,49 @@ echo "开始部署微信小程序后端服务..." # 检查是否安装了Docker -echo "检查Docker是否安装..." -if ! command -v docker &> /dev/null; then - echo "错误: Docker未安装,请先安装Docker" - exit 1 -fi + echo "检查Docker是否安装..." + if ! command -v docker &> /dev/null; then + echo "错误: Docker未安装,请先安装Docker" + exit 1 + fi + +# 配置Docker国内镜像源加速 + echo "配置Docker国内镜像源加速..." + mkdir -p /etc/docker + cat > /etc/docker/daemon.json </dev/null || true +sleep 5 + + # 配置Docker镜像加速 + echo "配置Docker镜像加速..." + mkdir -p /etc/docker + cat > /etc/docker/daemon.json << EOF + { + "registry-mirrors": [ + "https://registry.cn-hangzhou.aliyuncs.com", + "https://docker.mirrors.ustc.edu.cn", + "https://mirror.baidubce.com" + ] + } + EOF + + # 重启Docker服务使配置生效 + systemctl daemon-reload 2>/dev/null || true + systemctl restart docker 2>/dev/null || true + sleep 5 # 检查并更新Docker Compose和Buildx echo "检查并更新Docker工具..." From 47713dadefbf88942810425d89808c89fa173434 Mon Sep 17 00:00:00 2001 From: SwTt29 <2055018491@qq.com> Date: Tue, 30 Dec 2025 10:53:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=EF=BC=9A=E5=90=88=E5=B9=B6=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E7=9A=84Docker=E9=95=9C=E5=83=8F=E5=8A=A0=E9=80=9F=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.sh | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/deploy.sh b/deploy.sh index f11b740..5de023c 100644 --- a/deploy.sh +++ b/deploy.sh @@ -14,32 +14,14 @@ echo "开始部署微信小程序后端服务..." # 配置Docker国内镜像源加速 echo "配置Docker国内镜像源加速..." mkdir -p /etc/docker - cat > /etc/docker/daemon.json </dev/null || true -sleep 5 - - # 配置Docker镜像加速 - echo "配置Docker镜像加速..." - mkdir -p /etc/docker cat > /etc/docker/daemon.json << EOF { "registry-mirrors": [ "https://registry.cn-hangzhou.aliyuncs.com", "https://docker.mirrors.ustc.edu.cn", - "https://mirror.baidubce.com" + "https://mirror.baidubce.com", + "https://hub-mirror.c.163.com", + "https://reg-mirror.qiniu.com" ] } EOF From 551f76f8985357febc40a65566e901f2423c7e4e Mon Sep 17 00:00:00 2001 From: SwTt29 <2055018491@qq.com> Date: Tue, 30 Dec 2025 10:56:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8DDockerfile=EF=BC=9A?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=AE=98=E6=96=B9Node=E9=95=9C=E5=83=8F?= =?UTF-8?q?=EF=BC=8C=E9=80=9A=E8=BF=87Docker=E9=95=9C=E5=83=8F=E5=8A=A0?= =?UTF-8?q?=E9=80=9F=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1b508a3..93e07ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -# 使用国内阿里云的Node.js 18镜像作为基础镜像 -FROM registry.cn-hangzhou.aliyuncs.com/library/node:18-alpine +# 使用官方的Node.js 18镜像作为基础镜像 +FROM node:18-alpine # 设置工作目录 WORKDIR /app