From 2140ae1f4bf7ac626b937f6a698f1d839d8aa7ed Mon Sep 17 00:00:00 2001 From: yuuki-nya Date: Fri, 22 Sep 2023 14:56:23 +0800 Subject: [PATCH] update files --- .github/workflows/docker-publish.yml | 27 +++++++++++ Dockerfile | 71 ++++++++++++++++++++++++++++ README.md | 41 +++++++++++++++- docker-compose.yml | 11 +++++ 4 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docker-publish.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..2be0d30 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,27 @@ +name: Docker Publish + +on: + push: + branches: + - main # 或者你想要触发工作流程的分支 + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: yuukinya/chronocat-docke:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..afab61f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,71 @@ +# 使用基于Ubuntu 22.04的基础映像 +FROM ubuntu:22.04 + +# 设置环境变量 +ENV DEBIAN_FRONTEND=noninteractive +ENV VNC_PASSWD=vncpasswd + +# 安装必要的软件包 +RUN apt-get update && apt-get install -y \ + openbox \ + curl \ + unzip \ + x11vnc \ + xvfb \ + fluxbox \ + supervisor \ + libnotify4 \ + libnss3 \ + xdg-utils \ + libsecret-1-0 \ + libgbm1 \ + libasound2 \ + fonts-wqy-zenhei \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# 新增用户 +RUN useradd -m -s /bin/bash user && echo 'user' + +# 安装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 + +# 安装LiteLoader +RUN curl -L -o /tmp/LiteLoaderQQNT.zip https://github.com/LiteLoaderQQNT/LiteLoaderQQNT/releases/download/0.5.3/LiteLoaderQQNT.zip \ + && unzip /tmp/LiteLoaderQQNT.zip -d /opt/QQ/resources/app/ \ + && rm /tmp/LiteLoaderQQNT.zip +# 修改/opt/QQ/resources/app/package.json文件 +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://github.com/chrononeko/chronocat/releases/download/v0.0.45/chronocat-llqqnt-v0.0.45.zip \ + && mkdir -p /home/user/LiteLoaderQQNT/plugins \ + && unzip /tmp/chronocat-llqqnt.zip -d /home/user/LiteLoaderQQNT/plugins/ \ + && chown -R user /home/user/LiteLoaderQQNT \ + && rm /tmp/chronocat-llqqnt.zip + +# 创建必要的目录 +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 +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 "su -c 'qq' user" >> ~/start.sh +RUN chmod +x ~/start.sh + +# 配置supervisor +RUN echo "[supervisord]" > /etc/supervisor/supervisord.conf +RUN echo "nodaemon=true" >> /etc/supervisor/supervisord.conf +RUN echo "[program:x11vnc]" >> /etc/supervisor/supervisord.conf +RUN echo "command=/usr/bin/x11vnc -display :1 -noxrecord -noxfixes -noxdamage -forever -rfbauth ~/.vnc/passwd" >> /etc/supervisor/supervisord.conf + +# 设置容器启动时运行的命令 +CMD ["/bin/bash", "-c", "/root/start.sh"] diff --git a/README.md b/README.md index 3e551d8..c498ddd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,41 @@ # chronocat-docker -使用docker运行带有chronocat的qqnt,镜像采用ubuntu22.04 + lxde桌面,镜像占用空间约2.2GB,启动内存占用约450MB + +使用ubuntu22.04 + openbox + linuxqq 制作 + +## 使用 + +```bash +docker run --rm -it -p 16530:16530 5900:5900 yuukinya/chronocat-docker +``` + +或者下载代码中的docker-compose.yml,然后执行 + +```bash +docker-compose up -d +``` + +### VNC登陆 + +使用VNC软件登陆`服务器IP:5900`,默认密码是`vncpasswd` + +### 获取RED_PROTOCOL_TOKEN + +```bash +docker exec ubuntu2204 cat /home/user/BetterUniverse/QQNT/RED_PROTOCOL_TOKEN +``` + +### 修改VNC密码 + +```bash +docker exec ubuntu2204 sh -c "x11vnc -storepasswd newpasswd /root/.vnc/passwd" +``` + +其中newpasswd换成你的新密码,完成后重启容器 + +## TODO + +- [ ] 使用docker-compose.yml的environment来修改VNC密码 +- [ ] 能固化已登陆QQ的数据 + + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d95c1d1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +services: + chronocat-docker: + image: yuukinya/chronocat-docker + tty: true + container_name: chronocat-docker + restart: always + ports: + - "5900:5900" + - "16530:16530" + environment: + - TZ=Asia/Shanghai \ No newline at end of file