diff --git a/Dockerfile b/Dockerfile index e594367..7e2bdcf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,9 +21,17 @@ RUN apt-get update && apt-get install -y \ libgbm1 \ libasound2 \ fonts-wqy-zenhei \ + git \ + gnutls-bin \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* +# 安装novnc +RUN git config --global http.sslVerify false && git config --global http.postBuffer 1048576000 +RUN cd /opt && git clone https://github.com/novnc/noVNC.git +RUN cd opt/noVNC/utils && git clone https://github.com/novnc/websockify.git +RUN cp /opt/noVNC/vnc.html /opt/noVNC/index.html + # 安装Linux QQ RUN curl -o /root/linuxqq_3.1.2-13107_amd64.deb https://dldir1.qq.com/qqfile/qq/QQNT/ad5b5393/linuxqq_3.1.2-13107_amd64.deb RUN dpkg -i /root/linuxqq_3.1.2-13107_amd64.deb && apt-get -f install -y && rm /root/linuxqq_3.1.2-13107_amd64.deb @@ -36,7 +44,7 @@ RUN curl -L -o /tmp/LiteLoaderQQNT.zip https://github.com/LiteLoaderQQNT/LiteLoa RUN sed -i 's/"main": ".\/app_launcher\/index.js"/"main": ".\/LiteLoader"/' /opt/QQ/resources/app/package.json # 安装chronocat -RUN curl -L -o /tmp/chronocat-llqqnt.zip https://ghproxy.com/https://github.com/chrononeko/chronocat/releases/download/v0.0.46/chronocat-llqqnt-v0.0.46.zip \ +RUN curl -L -o /tmp/chronocat-llqqnt.zip https://ghproxy.com/https://github.com/chrononeko/chronocat/releases/download/v0.0.48/chronocat-llqqnt-v0.0.48.zip \ && mkdir -p /root/LiteLoaderQQNT/plugins \ && unzip /tmp/chronocat-llqqnt.zip -d /root/LiteLoaderQQNT/plugins/ \ && rm /tmp/chronocat-llqqnt.zip @@ -44,9 +52,6 @@ RUN curl -L -o /tmp/chronocat-llqqnt.zip https://ghproxy.com/https://github.com/ # 创建必要的目录 RUN mkdir -p ~/.vnc -# 设置VNC密码 -RUN x11vnc -storepasswd $VNC_PASSWD ~/.vnc/passwd - # 创建启动脚本 RUN echo "#!/bin/bash" > ~/start.sh RUN echo "rm /tmp/.X1-lock" >> ~/start.sh @@ -54,6 +59,8 @@ RUN echo "Xvfb :1 -screen 0 1280x1024x16 &" >> ~/start.sh RUN echo "export DISPLAY=:1" >> ~/start.sh RUN echo "fluxbox &" >> ~/start.sh RUN echo "x11vnc -display :1 -noxrecord -noxfixes -noxdamage -forever -rfbauth ~/.vnc/passwd &" >> ~/start.sh +RUN echo "nohup /opt/noVNC/utils/novnc_proxy --vnc localhost:5900 --listen 6081 --file-only &" >> ~/start.sh +RUN echo "x11vnc -storepasswd \$VNC_PASSWD ~/.vnc/passwd" >> ~/start.sh RUN echo "su -c 'qq' root" >> ~/start.sh RUN chmod +x ~/start.sh diff --git a/README.md b/README.md index f115c99..0efb2eb 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,11 @@ 容器重建会丢失已登陆QQ数据 ```bash -docker run -d --name chronocat-docker -p 16530:16530 -p 5900:5900 -v ${PWD}/config:/root/.chronocat/config yuukinya/chronocat-docker +docker run -d --name chronocat-docker -e VNC_PASSWD=vncpasswd -p 5900:5900 -p 6081:6081 -p 16530:16530 -v ${PWD}/config:/root/.chronocat/config yuukinya/chronocat-docker ``` +其中vncpasswd换成你的VNC密码 + 或者下载代码中的docker-compose.yml,然后执行 ```bash @@ -32,7 +34,7 @@ docker cp chronocat-docker:/root/.config/QQ ./data 如果之前是docker run运行的,执行 ```bash -docker rm -f chronocat-docker && run -d --name chronocat-docker -p 16530:16530 -p 5900:5900 -v ${PWD}/config:/root/.chronocat/config -v ${PWD}/data/QQ:/root/.config/QQ yuukinya/chronocat-docker +docker run -d --name chronocat-docker -e VNC_PASSWD=vncpasswd -p 5900:5900 -p 6081:6081 -p 16530:16530 -v ${PWD}/config:/root/.chronocat/config -v ${PWD}/data/QQ:/root/.config/QQ yuukinya/chronocat-docker ``` 如果之前是docker-compose运行的,编辑docker-compose.yml,把volumes下两行的开头注释去掉,保存,再执行 @@ -41,6 +43,10 @@ docker rm -f chronocat-docker && run -d --name chronocat-docker -p 16530:16530 - docker-compose up -d ``` +### noVNC登陆 + +浏览器访问`http://服务器IP:6081`,默认密码是`vncpasswd` + ### VNC登陆 使用VNC软件登陆`服务器IP:5900`,默认密码是`vncpasswd` @@ -57,6 +63,24 @@ docker exec chronocat-docker sh -c "x11vnc -storepasswd newpasswd /root/.vnc/pas 其中newpasswd换成你的新密码,立即生效,无需重启容器 +## 如何更新 + +1. 更新前请做好数据备份,比如数据固化 + +2. 删除容器并删除镜像,下面是代码示例 + + ```bash + docker rm -f chronocat-docker && docker rmi yuukinya/chronocat-docker + ``` + +3. 重新pull最近镜像 + + ```bash + docker pull yuukinya/chronocat-docker + ``` + +4. 按照前面的使用教程操作 + ## 已知问题 - 容器重启后,桌面的任务栏可能会消失,如果触发了请不要缩小或者点叉关闭,建议保持在聊天的界面,再关闭VNC远程 @@ -65,15 +89,23 @@ docker exec chronocat-docker sh -c "x11vnc -storepasswd newpasswd /root/.vnc/pas ## TODO - [x] 能固化已登陆QQ的数据 -- [ ] 使用docker的environment来指定VNC密码 +- [x] 使用docker的environment来指定VNC密码 ## 更新日志 +### 2023-10-3 + +- 更新chronocat至0.0.48 +- 使用docker的environment来指定VNC密码 [Issue #2](https://github.com/yuuki-nya/chronocat-docker/issues/2) +- 新增noVNC,使用浏览器来登陆VNC [Issue #2](https://github.com/yuuki-nya/chronocat-docker/issues/2) + +感谢 [ZGLinus](https://github.com/ZGLinus)提供的思路和代码 + ### 2023-9-25 - 更新chronocat至0.0.46 - 修改chronocat配置映射至宿主机 -- 固化已登陆QQ数据 +- 固化已登陆QQ数据 [Issue #1](https://github.com/yuuki-nya/chronocat-docker/issues/1) ### 2023-9-22 diff --git a/docker-compose.yml b/docker-compose.yml index 02fa80c..46765a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,9 +6,11 @@ services: restart: always ports: - "5900:5900" + - "6081:6081" - "16530:16530" environment: - TZ=Asia/Shanghai + - VNC_PASSWD=vncpasswd volumes: - ./config:/root/.chronocat/config # - ./data/QQ:/root/.config/QQ #QQ数据固化目录,请先阅读README再使用