From bbb5596ab54862c42deb6f0c8e0e9f6a1d2384e3 Mon Sep 17 00:00:00 2001 From: chenxingyu0001 <101016138+chenxingyu0001@users.noreply.github.com> Date: Sun, 3 Aug 2025 18:51:49 +0800 Subject: [PATCH 1/7] Create Dockerfile-cn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add: 增加国内镜像源,加快国内网络环境镜像构建速度 --- Dockerfile-cn | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 Dockerfile-cn diff --git a/Dockerfile-cn b/Dockerfile-cn new file mode 100644 index 0000000..4f2baa8 --- /dev/null +++ b/Dockerfile-cn @@ -0,0 +1,128 @@ +# 使用Python 3.11作为基础镜像 +FROM python:3.11-slim + +# 设置标签信息 +LABEL maintainer="Xianyu Auto Reply System" +LABEL version="2.0.0" +LABEL description="闲鱼自动回复系统 - 企业级多用户版本" +LABEL repository="https://github.com/zhinianboke/xianyu-auto-reply" + +# 设置工作目录 +WORKDIR /app + +# 设置环境变量 +ENV PYTHONUNBUFFERED=1 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV TZ=Asia/Shanghai + +#更换阿里云源 +RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources + +# 安装系统依赖(包括Playwright浏览器依赖) +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + nodejs \ + npm \ + tzdata \ + curl \ + libjpeg-dev \ + libpng-dev \ + libfreetype6-dev \ + fonts-dejavu-core \ + # Playwright浏览器依赖 + libnss3 \ + libnspr4 \ + libatk-bridge2.0-0 \ + libdrm2 \ + libxkbcommon0 \ + libxcomposite1 \ + libxdamage1 \ + libxrandr2 \ + libgbm1 \ + libxss1 \ + libasound2 \ + libatspi2.0-0 \ + libgtk-3-0 \ + libgdk-pixbuf2.0-0 \ + libxcursor1 \ + libxi6 \ + libxrender1 \ + libxext6 \ + libx11-6 \ + libxft2 \ + libxinerama1 \ + libxrandr2 \ + libxss1 \ + libxtst6 \ + ca-certificates \ + fonts-liberation \ + libappindicator3-1 \ + libasound2 \ + libatk-bridge2.0-0 \ + libdrm2 \ + libgtk-3-0 \ + libnspr4 \ + libnss3 \ + libx11-xcb1 \ + libxcomposite1 \ + libxcursor1 \ + libxdamage1 \ + libxfixes3 \ + libxi6 \ + libxrandr2 \ + libxrender1 \ + libxss1 \ + libxtst6 \ + xdg-utils \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# 设置时区 +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +# 验证Node.js安装并设置环境变量 +RUN node --version && npm --version +ENV NODE_PATH=/usr/lib/node_modules + +# 复制requirements.txt并安装Python依赖 +COPY requirements.txt . +RUN pip install --no-cache-dir --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple&& \ + pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple + +# 复制项目文件 +COPY . . + +# 安装Playwright浏览器(必须在复制项目文件之后) +RUN playwright install chromium && \ + playwright install-deps chromium + +# 创建必要的目录并设置权限 +RUN mkdir -p /app/logs /app/data /app/backups && \ + chmod 777 /app/logs /app/data /app/backups + +# 注意: 为了简化权限问题,使用root用户运行 +# 在生产环境中,建议配置适当的用户映射 + +# 暴露端口 +EXPOSE 8080 + +# 健康检查 +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD curl -f http://localhost:8080/health || exit 1 + +# 创建启动脚本 +RUN echo '#!/bin/bash' > /app/entrypoint.sh && \ + echo 'set -e' >> /app/entrypoint.sh && \ + echo '' >> /app/entrypoint.sh && \ + echo 'echo "🚀 启动闲鱼自动回复系统..."' >> /app/entrypoint.sh && \ + echo '' >> /app/entrypoint.sh && \ + echo '# 数据库将在应用启动时自动初始化' >> /app/entrypoint.sh && \ + echo 'echo "📊 数据库将在应用启动时自动初始化..."' >> /app/entrypoint.sh && \ + echo '' >> /app/entrypoint.sh && \ + echo '# 启动主应用' >> /app/entrypoint.sh && \ + echo 'echo "🎯 启动主应用..."' >> /app/entrypoint.sh && \ + echo 'exec python Start.py' >> /app/entrypoint.sh && \ + chmod +x /app/entrypoint.sh + +# 启动命令 +CMD ["/app/entrypoint.sh"] From 41c5ff269bc294fde7468e0e86f3e230fcc4a6e3 Mon Sep 17 00:00:00 2001 From: chenxingyu0001 <101016138+chenxingyu0001@users.noreply.github.com> Date: Sun, 3 Aug 2025 18:57:27 +0800 Subject: [PATCH 2/7] Create docker-compose-cn.yaml Add: docker-compose-cn.yaml --- docker-compose-cn.yaml | 107 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 docker-compose-cn.yaml diff --git a/docker-compose-cn.yaml b/docker-compose-cn.yaml new file mode 100644 index 0000000..b20559a --- /dev/null +++ b/docker-compose-cn.yaml @@ -0,0 +1,107 @@ +services: + xianyu-app: + build: + context: . + dockerfile: Dockerfile-cn + image: xianyu-auto-reply:latest + container_name: xianyu-auto-reply + restart: unless-stopped + # 使用root用户避免权限问题 + user: "0:0" + ports: + - "${WEB_PORT:-8080}:8080" + volumes: + # 数据持久化 + - ./data:/app/data:rw + - ./logs:/app/logs:rw + - ./global_config.yml:/app/global_config.yml:ro + # 可选:如果需要自定义配置 + # - ./custom_config.yml:/app/global_config.yml:ro + # 可选:备份目录 + - ./backups:/app/backups:rw + environment: + - PYTHONUNBUFFERED=${PYTHONUNBUFFERED:-1} + - PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE:-1} + - TZ=${TZ:-Asia/Shanghai} + - DB_PATH=${DB_PATH:-/app/data/xianyu_data.db} + - LOG_LEVEL=${LOG_LEVEL:-INFO} + - DEBUG=${DEBUG:-false} + - RELOAD=${RELOAD:-false} + # SQL日志配置(默认启用,可通过环境变量覆盖) + - SQL_LOG_ENABLED=${SQL_LOG_ENABLED:-true} + - SQL_LOG_LEVEL=${SQL_LOG_LEVEL:-INFO} + - ADMIN_USERNAME=${ADMIN_USERNAME:-admin} + - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin123} + - JWT_SECRET_KEY=${JWT_SECRET_KEY:-default-secret-key} + - SESSION_TIMEOUT=${SESSION_TIMEOUT:-3600} + # 多用户系统配置 + - MULTIUSER_ENABLED=${MULTIUSER_ENABLED:-true} + - USER_REGISTRATION_ENABLED=${USER_REGISTRATION_ENABLED:-true} + - EMAIL_VERIFICATION_ENABLED=${EMAIL_VERIFICATION_ENABLED:-true} + - CAPTCHA_ENABLED=${CAPTCHA_ENABLED:-true} + - TOKEN_EXPIRE_TIME=${TOKEN_EXPIRE_TIME:-86400} + - AUTO_REPLY_ENABLED=${AUTO_REPLY_ENABLED:-true} + - AUTO_DELIVERY_ENABLED=${AUTO_DELIVERY_ENABLED:-true} + - AUTO_DELIVERY_TIMEOUT=${AUTO_DELIVERY_TIMEOUT:-30} + - API_CARD_TIMEOUT=${API_CARD_TIMEOUT:-10} + - BATCH_DATA_LOCK_TIMEOUT=${BATCH_DATA_LOCK_TIMEOUT:-5} + # AI回复相关配置 + - AI_REPLY_ENABLED=${AI_REPLY_ENABLED:-false} + - DEFAULT_AI_MODEL=${DEFAULT_AI_MODEL:-qwen-plus} + - DEFAULT_AI_BASE_URL=${DEFAULT_AI_BASE_URL:-https://dashscope.aliyuncs.com/compatible-mode/v1} + - AI_REQUEST_TIMEOUT=${AI_REQUEST_TIMEOUT:-30} + - AI_MAX_TOKENS=${AI_MAX_TOKENS:-100} + - WEBSOCKET_URL=${WEBSOCKET_URL:-wss://wss-goofish.dingtalk.com/} + - HEARTBEAT_INTERVAL=${HEARTBEAT_INTERVAL:-15} + - HEARTBEAT_TIMEOUT=${HEARTBEAT_TIMEOUT:-5} + - TOKEN_REFRESH_INTERVAL=${TOKEN_REFRESH_INTERVAL:-3600} + - TOKEN_RETRY_INTERVAL=${TOKEN_RETRY_INTERVAL:-300} + - MESSAGE_EXPIRE_TIME=${MESSAGE_EXPIRE_TIME:-300000} + env_file: + - path: .env + required: false + networks: + - xianyu-network + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + # 资源限制 + deploy: + resources: + limits: + memory: ${MEMORY_LIMIT:-512}M + cpus: '${CPU_LIMIT:-0.5}' + reservations: + memory: ${MEMORY_RESERVATION:-256}M + cpus: '${CPU_RESERVATION:-0.25}' + + # 可选:添加Nginx反向代理 + nginx: + image: nginx:alpine + container_name: xianyu-nginx + restart: unless-stopped + ports: + - "80:80" + - "443:443" + volumes: + - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro + - ./nginx/ssl:/etc/nginx/ssl:ro + depends_on: + - xianyu-app + networks: + - xianyu-network + profiles: + - with-nginx + +networks: + xianyu-network: + driver: bridge + +volumes: + xianyu-data: + driver: local + xianyu-logs: + driver: local From 9105bd03a7e71b3beb32168286308dea397e630b Mon Sep 17 00:00:00 2001 From: chenxingyu0001 <101016138+chenxingyu0001@users.noreply.github.com> Date: Sun, 3 Aug 2025 19:12:21 +0800 Subject: [PATCH 3/7] Delete docker-compose-cn.yaml --- docker-compose-cn.yaml | 107 ----------------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 docker-compose-cn.yaml diff --git a/docker-compose-cn.yaml b/docker-compose-cn.yaml deleted file mode 100644 index b20559a..0000000 --- a/docker-compose-cn.yaml +++ /dev/null @@ -1,107 +0,0 @@ -services: - xianyu-app: - build: - context: . - dockerfile: Dockerfile-cn - image: xianyu-auto-reply:latest - container_name: xianyu-auto-reply - restart: unless-stopped - # 使用root用户避免权限问题 - user: "0:0" - ports: - - "${WEB_PORT:-8080}:8080" - volumes: - # 数据持久化 - - ./data:/app/data:rw - - ./logs:/app/logs:rw - - ./global_config.yml:/app/global_config.yml:ro - # 可选:如果需要自定义配置 - # - ./custom_config.yml:/app/global_config.yml:ro - # 可选:备份目录 - - ./backups:/app/backups:rw - environment: - - PYTHONUNBUFFERED=${PYTHONUNBUFFERED:-1} - - PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE:-1} - - TZ=${TZ:-Asia/Shanghai} - - DB_PATH=${DB_PATH:-/app/data/xianyu_data.db} - - LOG_LEVEL=${LOG_LEVEL:-INFO} - - DEBUG=${DEBUG:-false} - - RELOAD=${RELOAD:-false} - # SQL日志配置(默认启用,可通过环境变量覆盖) - - SQL_LOG_ENABLED=${SQL_LOG_ENABLED:-true} - - SQL_LOG_LEVEL=${SQL_LOG_LEVEL:-INFO} - - ADMIN_USERNAME=${ADMIN_USERNAME:-admin} - - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin123} - - JWT_SECRET_KEY=${JWT_SECRET_KEY:-default-secret-key} - - SESSION_TIMEOUT=${SESSION_TIMEOUT:-3600} - # 多用户系统配置 - - MULTIUSER_ENABLED=${MULTIUSER_ENABLED:-true} - - USER_REGISTRATION_ENABLED=${USER_REGISTRATION_ENABLED:-true} - - EMAIL_VERIFICATION_ENABLED=${EMAIL_VERIFICATION_ENABLED:-true} - - CAPTCHA_ENABLED=${CAPTCHA_ENABLED:-true} - - TOKEN_EXPIRE_TIME=${TOKEN_EXPIRE_TIME:-86400} - - AUTO_REPLY_ENABLED=${AUTO_REPLY_ENABLED:-true} - - AUTO_DELIVERY_ENABLED=${AUTO_DELIVERY_ENABLED:-true} - - AUTO_DELIVERY_TIMEOUT=${AUTO_DELIVERY_TIMEOUT:-30} - - API_CARD_TIMEOUT=${API_CARD_TIMEOUT:-10} - - BATCH_DATA_LOCK_TIMEOUT=${BATCH_DATA_LOCK_TIMEOUT:-5} - # AI回复相关配置 - - AI_REPLY_ENABLED=${AI_REPLY_ENABLED:-false} - - DEFAULT_AI_MODEL=${DEFAULT_AI_MODEL:-qwen-plus} - - DEFAULT_AI_BASE_URL=${DEFAULT_AI_BASE_URL:-https://dashscope.aliyuncs.com/compatible-mode/v1} - - AI_REQUEST_TIMEOUT=${AI_REQUEST_TIMEOUT:-30} - - AI_MAX_TOKENS=${AI_MAX_TOKENS:-100} - - WEBSOCKET_URL=${WEBSOCKET_URL:-wss://wss-goofish.dingtalk.com/} - - HEARTBEAT_INTERVAL=${HEARTBEAT_INTERVAL:-15} - - HEARTBEAT_TIMEOUT=${HEARTBEAT_TIMEOUT:-5} - - TOKEN_REFRESH_INTERVAL=${TOKEN_REFRESH_INTERVAL:-3600} - - TOKEN_RETRY_INTERVAL=${TOKEN_RETRY_INTERVAL:-300} - - MESSAGE_EXPIRE_TIME=${MESSAGE_EXPIRE_TIME:-300000} - env_file: - - path: .env - required: false - networks: - - xianyu-network - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8080/health"] - interval: 30s - timeout: 10s - retries: 3 - start_period: 40s - # 资源限制 - deploy: - resources: - limits: - memory: ${MEMORY_LIMIT:-512}M - cpus: '${CPU_LIMIT:-0.5}' - reservations: - memory: ${MEMORY_RESERVATION:-256}M - cpus: '${CPU_RESERVATION:-0.25}' - - # 可选:添加Nginx反向代理 - nginx: - image: nginx:alpine - container_name: xianyu-nginx - restart: unless-stopped - ports: - - "80:80" - - "443:443" - volumes: - - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro - - ./nginx/ssl:/etc/nginx/ssl:ro - depends_on: - - xianyu-app - networks: - - xianyu-network - profiles: - - with-nginx - -networks: - xianyu-network: - driver: bridge - -volumes: - xianyu-data: - driver: local - xianyu-logs: - driver: local From 9412b392a586d222fd814bb9c7dc7ae9e7103751 Mon Sep 17 00:00:00 2001 From: chenxingyu0001 <101016138+chenxingyu0001@users.noreply.github.com> Date: Sun, 3 Aug 2025 19:32:23 +0800 Subject: [PATCH 4/7] Update docker-deploy.sh --- docker-deploy.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker-deploy.sh b/docker-deploy.sh index 0d025a7..47434bd 100644 --- a/docker-deploy.sh +++ b/docker-deploy.sh @@ -70,7 +70,12 @@ init_config() { # 构建镜像 build_image() { print_info "构建 Docker 镜像..." - docker-compose build --no-cache + echo "是否需要使用国内镜像(y/n): " && read iscn + if [[ $iscn == "y" ]]; then + docker-compose -f docker-compose-cn.yml build --no-cache + else + docker-compose build --no-cache + fi print_success "镜像构建完成" } From f57952d400f693b46903bf495a0eac9851970af7 Mon Sep 17 00:00:00 2001 From: chenxingyu0001 <101016138+chenxingyu0001@users.noreply.github.com> Date: Sun, 3 Aug 2025 19:33:08 +0800 Subject: [PATCH 5/7] Create docker-compose-cn.yml --- docker-compose-cn.yml | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 docker-compose-cn.yml diff --git a/docker-compose-cn.yml b/docker-compose-cn.yml new file mode 100644 index 0000000..b20559a --- /dev/null +++ b/docker-compose-cn.yml @@ -0,0 +1,107 @@ +services: + xianyu-app: + build: + context: . + dockerfile: Dockerfile-cn + image: xianyu-auto-reply:latest + container_name: xianyu-auto-reply + restart: unless-stopped + # 使用root用户避免权限问题 + user: "0:0" + ports: + - "${WEB_PORT:-8080}:8080" + volumes: + # 数据持久化 + - ./data:/app/data:rw + - ./logs:/app/logs:rw + - ./global_config.yml:/app/global_config.yml:ro + # 可选:如果需要自定义配置 + # - ./custom_config.yml:/app/global_config.yml:ro + # 可选:备份目录 + - ./backups:/app/backups:rw + environment: + - PYTHONUNBUFFERED=${PYTHONUNBUFFERED:-1} + - PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE:-1} + - TZ=${TZ:-Asia/Shanghai} + - DB_PATH=${DB_PATH:-/app/data/xianyu_data.db} + - LOG_LEVEL=${LOG_LEVEL:-INFO} + - DEBUG=${DEBUG:-false} + - RELOAD=${RELOAD:-false} + # SQL日志配置(默认启用,可通过环境变量覆盖) + - SQL_LOG_ENABLED=${SQL_LOG_ENABLED:-true} + - SQL_LOG_LEVEL=${SQL_LOG_LEVEL:-INFO} + - ADMIN_USERNAME=${ADMIN_USERNAME:-admin} + - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin123} + - JWT_SECRET_KEY=${JWT_SECRET_KEY:-default-secret-key} + - SESSION_TIMEOUT=${SESSION_TIMEOUT:-3600} + # 多用户系统配置 + - MULTIUSER_ENABLED=${MULTIUSER_ENABLED:-true} + - USER_REGISTRATION_ENABLED=${USER_REGISTRATION_ENABLED:-true} + - EMAIL_VERIFICATION_ENABLED=${EMAIL_VERIFICATION_ENABLED:-true} + - CAPTCHA_ENABLED=${CAPTCHA_ENABLED:-true} + - TOKEN_EXPIRE_TIME=${TOKEN_EXPIRE_TIME:-86400} + - AUTO_REPLY_ENABLED=${AUTO_REPLY_ENABLED:-true} + - AUTO_DELIVERY_ENABLED=${AUTO_DELIVERY_ENABLED:-true} + - AUTO_DELIVERY_TIMEOUT=${AUTO_DELIVERY_TIMEOUT:-30} + - API_CARD_TIMEOUT=${API_CARD_TIMEOUT:-10} + - BATCH_DATA_LOCK_TIMEOUT=${BATCH_DATA_LOCK_TIMEOUT:-5} + # AI回复相关配置 + - AI_REPLY_ENABLED=${AI_REPLY_ENABLED:-false} + - DEFAULT_AI_MODEL=${DEFAULT_AI_MODEL:-qwen-plus} + - DEFAULT_AI_BASE_URL=${DEFAULT_AI_BASE_URL:-https://dashscope.aliyuncs.com/compatible-mode/v1} + - AI_REQUEST_TIMEOUT=${AI_REQUEST_TIMEOUT:-30} + - AI_MAX_TOKENS=${AI_MAX_TOKENS:-100} + - WEBSOCKET_URL=${WEBSOCKET_URL:-wss://wss-goofish.dingtalk.com/} + - HEARTBEAT_INTERVAL=${HEARTBEAT_INTERVAL:-15} + - HEARTBEAT_TIMEOUT=${HEARTBEAT_TIMEOUT:-5} + - TOKEN_REFRESH_INTERVAL=${TOKEN_REFRESH_INTERVAL:-3600} + - TOKEN_RETRY_INTERVAL=${TOKEN_RETRY_INTERVAL:-300} + - MESSAGE_EXPIRE_TIME=${MESSAGE_EXPIRE_TIME:-300000} + env_file: + - path: .env + required: false + networks: + - xianyu-network + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + # 资源限制 + deploy: + resources: + limits: + memory: ${MEMORY_LIMIT:-512}M + cpus: '${CPU_LIMIT:-0.5}' + reservations: + memory: ${MEMORY_RESERVATION:-256}M + cpus: '${CPU_RESERVATION:-0.25}' + + # 可选:添加Nginx反向代理 + nginx: + image: nginx:alpine + container_name: xianyu-nginx + restart: unless-stopped + ports: + - "80:80" + - "443:443" + volumes: + - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro + - ./nginx/ssl:/etc/nginx/ssl:ro + depends_on: + - xianyu-app + networks: + - xianyu-network + profiles: + - with-nginx + +networks: + xianyu-network: + driver: bridge + +volumes: + xianyu-data: + driver: local + xianyu-logs: + driver: local From c91d9db48f01108209222b3d0a5f98f805a84113 Mon Sep 17 00:00:00 2001 From: chenxingyu0001 <101016138+chenxingyu0001@users.noreply.github.com> Date: Sun, 3 Aug 2025 19:52:42 +0800 Subject: [PATCH 6/7] Update Dockerfile-cn --- Dockerfile-cn | 66 ++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/Dockerfile-cn b/Dockerfile-cn index 4f2baa8..e051bb1 100644 --- a/Dockerfile-cn +++ b/Dockerfile-cn @@ -2,10 +2,12 @@ FROM python:3.11-slim # 设置标签信息 -LABEL maintainer="Xianyu Auto Reply System" -LABEL version="2.0.0" -LABEL description="闲鱼自动回复系统 - 企业级多用户版本" +LABEL maintainer="zhinianboke" +LABEL version="2.1.0" +LABEL description="闲鱼自动回复系统 - 企业级多用户版本,支持自动发货和免拼发货" LABEL repository="https://github.com/zhinianboke/xianyu-auto-reply" +LABEL license="仅供学习使用,禁止商业用途" +LABEL author="zhinianboke" # 设置工作目录 WORKDIR /app @@ -14,21 +16,27 @@ WORKDIR /app ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 ENV TZ=Asia/Shanghai +ENV DOCKER_ENV=true +ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright -#更换阿里云源 +#更换中科大源 RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources # 安装系统依赖(包括Playwright浏览器依赖) RUN apt-get update && \ apt-get install -y --no-install-recommends \ + # 基础工具 nodejs \ npm \ tzdata \ curl \ + ca-certificates \ + # 图像处理依赖 libjpeg-dev \ libpng-dev \ libfreetype6-dev \ fonts-dejavu-core \ + fonts-liberation \ # Playwright浏览器依赖 libnss3 \ libnspr4 \ @@ -51,31 +59,15 @@ RUN apt-get update && \ libx11-6 \ libxft2 \ libxinerama1 \ - libxrandr2 \ - libxss1 \ libxtst6 \ - ca-certificates \ - fonts-liberation \ libappindicator3-1 \ - libasound2 \ - libatk-bridge2.0-0 \ - libdrm2 \ - libgtk-3-0 \ - libnspr4 \ - libnss3 \ libx11-xcb1 \ - libxcomposite1 \ - libxcursor1 \ - libxdamage1 \ libxfixes3 \ - libxi6 \ - libxrandr2 \ - libxrender1 \ - libxss1 \ - libxtst6 \ xdg-utils \ && apt-get clean \ - && rm -rf /var/lib/apt/lists/* + && rm -rf /var/lib/apt/lists/* \ + && rm -rf /tmp/* \ + && rm -rf /var/tmp/* # 设置时区 RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -111,18 +103,22 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8080/health || exit 1 # 创建启动脚本 -RUN echo '#!/bin/bash' > /app/entrypoint.sh && \ - echo 'set -e' >> /app/entrypoint.sh && \ - echo '' >> /app/entrypoint.sh && \ - echo 'echo "🚀 启动闲鱼自动回复系统..."' >> /app/entrypoint.sh && \ - echo '' >> /app/entrypoint.sh && \ - echo '# 数据库将在应用启动时自动初始化' >> /app/entrypoint.sh && \ - echo 'echo "📊 数据库将在应用启动时自动初始化..."' >> /app/entrypoint.sh && \ - echo '' >> /app/entrypoint.sh && \ - echo '# 启动主应用' >> /app/entrypoint.sh && \ - echo 'echo "🎯 启动主应用..."' >> /app/entrypoint.sh && \ - echo 'exec python Start.py' >> /app/entrypoint.sh && \ - chmod +x /app/entrypoint.sh +COPY < Date: Sun, 3 Aug 2025 19:53:25 +0800 Subject: [PATCH 7/7] Update docker-compose-cn.yml