🐛 fix a bug.
Some checks failed
BuildImage / build-image (push) Failing after 1m18s

This commit is contained in:
lxh 2025-02-17 15:08:21 +08:00 committed by lxh
parent 21d0618b80
commit 3fde6db7a0
2 changed files with 21 additions and 18 deletions

View File

@ -9,17 +9,12 @@ LABEL org.opencontainers.image.authors="lxh@cxh.cn"
# 预定义参数 # 预定义参数
ENV TZ="Asia/Shanghai" 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
# 设置时区 # 设置时区和安装Redis
#RUN apk add --no-cache tzdata && \ RUN apk add --no-cache tzdata redis-server && \
# cp /usr/share/zoneinfo/${TZ} /etc/localtime && \ cp /usr/share/zoneinfo/${TZ} /etc/localtime && \
# echo "${TZ}" > /etc/timezone echo "${TZ}" > /etc/timezone && \
rm -rf /var/lib/apt/lists/*
# 设置工作目录 # 设置工作目录
WORKDIR /app WORKDIR /app
@ -29,13 +24,16 @@ COPY . .
COPY --from=core /usr/local/lib/python3.11/site-packages/xywechatpad_binary/binaries/linux_x64 ./WechatAPI/core/ COPY --from=core /usr/local/lib/python3.11/site-packages/xywechatpad_binary/binaries/linux_x64 ./WechatAPI/core/
#RUN ls -lah ./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-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 \ #CMD /app/WechatAPI/core/XYWechatPad \
--port $PORT \ # --port $PORT \
--mode $MODE \ # --mode $MODE \
--redis-host $REDIS_HOST \ # --redis-host $REDIS_HOST \
--redis-port $REDIS_PORT \ # --redis-port $REDIS_PORT \
--redis-password $REDIS_PASSWORD \ # --redis-password $REDIS_PASSWORD \
--redis-db $REDIS_DB # --redis-db $REDIS_DB
CMD ["./entrypoint.sh"]

5
entrypoint.sh Normal file
View File

@ -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