From 3fde6db7a03e8dbe9d9ac0d5f8eb1574292ffb87 Mon Sep 17 00:00:00 2001 From: lxh Date: Mon, 17 Feb 2025 15:08:21 +0800 Subject: [PATCH] :bug: fix a bug. --- Dockerfile | 34 ++++++++++++++++------------------ entrypoint.sh | 5 +++++ 2 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index e9b1cae..f16abfc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,17 +9,12 @@ LABEL org.opencontainers.image.authors="lxh@cxh.cn" # 预定义参数 ENV TZ="Asia/Shanghai" -ENV PORT=9000 -ENV MODE=release -ENV REDIS_HOST="127.0.0.1" -ENV REDIS_PORT=6379 -ENV REDIS_PASSWORD="" -ENV REDIS_DB=0 -# 设置时区 -#RUN apk add --no-cache tzdata && \ -# cp /usr/share/zoneinfo/${TZ} /etc/localtime && \ -# echo "${TZ}" > /etc/timezone +# 设置时区和安装Redis +RUN apk add --no-cache tzdata redis-server && \ + cp /usr/share/zoneinfo/${TZ} /etc/localtime && \ + echo "${TZ}" > /etc/timezone && \ + rm -rf /var/lib/apt/lists/* # 设置工作目录 WORKDIR /app @@ -29,13 +24,16 @@ COPY . . COPY --from=core /usr/local/lib/python3.11/site-packages/xywechatpad_binary/binaries/linux_x64 ./WechatAPI/core/ #RUN ls -lah ./WechatAPI/core +# 授权脚本可执行 +RUN chmod +x entrypoint.sh + # 开始运行 #CMD ["/app/WechatAPI/core/XYWechatPad-linux-x86", "--port", "${PORT}", "--mode", "${MODE}", "--redis-host", "${REDIS_HOST}", " --redis-port", "${REDIS_PORT}", "--redis-password", "${REDIS_PASSWORD}", "--redis-db", "${REDIS_DB}"] -CMD /app/WechatAPI/core/XYWechatPad \ - --port $PORT \ - --mode $MODE \ - --redis-host $REDIS_HOST \ - --redis-port $REDIS_PORT \ - --redis-password $REDIS_PASSWORD \ - --redis-db $REDIS_DB - +#CMD /app/WechatAPI/core/XYWechatPad \ +# --port $PORT \ +# --mode $MODE \ +# --redis-host $REDIS_HOST \ +# --redis-port $REDIS_PORT \ +# --redis-password $REDIS_PASSWORD \ +# --redis-db $REDIS_DB +CMD ["./entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..675fb0b --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# 启动Redis服务 +service redis-server start +# 执行主程序 +/app/WechatAPI/core/XYWechatPad --port 9000 --mode release --redis-host 127.0.0.1 --redis-port 6379 --redis-password "" --redis-db 0