diff --git a/Dockerfile b/Dockerfile index eb19f54..695cb01 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN apt-get update && \ libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 \ libxcomposite1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 \ libxss1 libxtst6 libatomic1 libxcomposite1 libxrender1 libxrandr2 libxkbcommon-x11-0 \ - libfontconfig1 libdbus-1-3 libnss3 libx11-xcb1 python3-tk + libfontconfig1 libdbus-1-3 libnss3 libx11-xcb1 python3-tk stalonetray RUN pip install --no-cache-dir python-xlib @@ -51,6 +51,26 @@ RUN case "$TARGETPLATFORM" in \ rm -f wechat.deb && \ echo "✅ WeChat installation completed for $WECHAT_ARCH" +# Install QQ based on target architecture +RUN case "$TARGETPLATFORM" in \ + "linux/amd64") \ + QQ_URL="https://dldir1v6.qq.com/qqfile/qq/QQNT/Linux/QQ_3.2.19_250904_amd64_01.deb"; \ + QQ_ARCH="x86_64" ;; \ + "linux/arm64") \ + QQ_URL="https://dldir1v6.qq.com/qqfile/qq/QQNT/Linux/QQ_3.2.19_250904_arm64_01.deb"; \ + QQ_ARCH="arm64" ;; \ + *) \ + echo "❌ Unsupported platform: $TARGETPLATFORM" >&2; \ + echo "Supported platforms: linux/amd64, linux/arm64" >&2; \ + exit 1 ;; \ + esac && \ + echo "📦 Downloading QQ for $QQ_ARCH architecture..." && \ + curl -fsSL -o qq.deb "$QQ_URL" && \ + echo "🔧 Installing QQ..." && \ + (dpkg -i qq.deb || (apt-get update && apt-get install -f -y && dpkg -i qq.deb)) && \ + rm -f qq.deb && \ + echo "✅ QQ installation completed for $QQ_ARCH" + # Clean up RUN apt-get purge -y --autoremove RUN apt-get autoclean && \ @@ -61,13 +81,18 @@ RUN apt-get autoclean && \ /var/tmp/* \ /tmp/* +# configure openbox dock mode for stalonetray +RUN sed -i '//,/<\/dock>/s/no<\/noStrut>/yes<\/noStrut>/' /etc/xdg/openbox/rc.xml + # set app name ENV TITLE="WeChat-Selkies" ENV TZ="Asia/Shanghai" ENV LC_ALL="zh_CN.UTF-8" +ENV AUTO_START_WECHAT="true" +ENV AUTO_START_QQ="false" # update favicon -COPY /root/wechat.png /usr/share/selkies/www/icon.png +RUN cp /usr/share/icons/hicolor/128x128/apps/wechat.png /usr/share/selkies/www/icon.png # add local files COPY /root / diff --git a/README.md b/README.md index 729f730..f9f1fc5 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,12 @@ ### 快速部署 1. **直接使用已构建的镜像进行快速部署** + GitHub Container Registry镜像: ```bash docker run -it -p 3001:3001 -v ./config:/config ghcr.io/nickrunning/wechat-selkies:latest ``` + Docker Hub镜像: ```bash docker run -it -p 3001:3001 -v ./config:/config nickrunning/wechat-selkies:latest @@ -58,7 +60,40 @@ docker run -it -p 3001:3001 -v ./config:/config nickrunning/wechat-selkies:lates 在浏览器中访问:`https://localhost:3001` 或 `https://<服务器IP>:3001` -### 自定义部署步骤(源码部署) +### docker-compose 部署 +1. **创建项目目录并进入** + ```bash + mkdir wechat-selkies + cd wechat-selkies + ``` +2. **创建 docker-compose.yml 文件** + ```yaml + services: + wechat-selkies: + image: nickrunning/wechat-selkies:latest # or ghcr.io/nickrunning/wechat-selkies:latest + container_name: wechat-selkies + ports: + - "3001:3001" + volumes: + - ./config:/config + devices: + - /dev/dri:/dev/dri # optional, for hardware acceleration + environment: + - PUID=1000 # user ID + - PGID=100 # group ID + - TZ=Asia/Shanghai # timezone + - LC_ALL=zh_CN.UTF-8 # locale + - AUTO_START_WECHAT=true # default is true + - AUTO_START_QQ=false # default is false + # - CUSTOM_USER= # recommended to set a custom user name + # - PASSWORD= # recommended to set a password for selkies web ui + ``` +3. **启动服务** + ```bash + docker-compose up -d + ``` + +### 源码部署 1. **克隆项目** ```bash @@ -83,10 +118,10 @@ docker run -it -p 3001:3001 -v ./config:/config nickrunning/wechat-selkies:lates 本项目支持同时推送到 GitHub Container Registry 和 Docker Hub。如需启用 Docker Hub 推送功能,请在仓库下添加Environment Secrets和Environment Variables: -**必需的Environment Secrets:** +**Environment Secrets:** * DOCKERHUB_USERNAME: 你的 Docker Hub 用户名 * DOCKERHUB_TOKEN: 你的 Docker Hub Access Token -**必需的Environment Variables:** +**Environment Variables:** * ENABLE_DOCKERHUB: 设置为 `true` 来启用 Docker Hub 推送 #### 环境变量配置 @@ -102,6 +137,8 @@ docker run -it -p 3001:3001 -v ./config:/config nickrunning/wechat-selkies:lates | `LC_ALL` | `zh_CN.UTF-8` | 语言环境 | | `CUSTOM_USER` | - | 自定义用户名(推荐设置) | | `PASSWORD` | - | Web UI 访问密码(推荐设置) | +| `AUTO_START_WECHAT` | `true` | 是否自动启动微信客户端 | +| `AUTO_START_QQ` | `false` | 是否自动启动 QQ 客户端 | #### 端口配置 diff --git a/README_en.md b/README_en.md index 576207a..c43267c 100644 --- a/README_en.md +++ b/README_en.md @@ -58,7 +58,40 @@ docker run -it -p 3001:3001 -v ./config:/config nickrunning/wechat-selkies:lates Open in browser: `https://localhost:3001` or `https://:3001` -### Custom Deployment (Source Code Deployment) +### docker-compose Deployment +1. **Create project directory and navigate into it** + ```bash + mkdir wechat-selkies + cd wechat-selkies + ``` +2. **Create `docker-compose.yml` file with the following content** + ```yaml + services: + wechat-selkies: + image: nickrunning/wechat-selkies:latest # or ghcr.io/nickrunning/wechat-selkies:latest + container_name: wechat-selkies + ports: + - "3001:3001" + volumes: + - ./config:/config + devices: + - /dev/dri:/dev/dri # optional, for hardware acceleration + environment: + - PUID=1000 # user ID + - PGID=100 # group ID + - TZ=Asia/Shanghai # timezone + - LC_ALL=zh_CN.UTF-8 # locale + - AUTO_START_WECHAT=true # default is true + - AUTO_START_QQ=false # default is false + # - CUSTOM_USER= # recommended to set a custom user name + # - PASSWORD= # recommended to set a password for selkies web ui + ``` +3. **Start the service** + ```bash + docker-compose up -d + ``` + +### Source Code Deployment 1. **Clone the repository** ```bash @@ -82,11 +115,11 @@ For more custom configurations, please refer to [Selkies Base Images from LinuxS #### Docker Hub Push Configuration This project supports pushing to both GitHub Container Registry and Docker Hub. Docker Hub push is optional and requires manual configuration. Please add the following Environment Secrets and Environment Variables in your repository to enable Docker Hub push functionality: -**Required Environment Secrets:** +**Environment Secrets:** * `DOCKERHUB_USERNAME`: Your Docker Hub username * `DOCKERHUB_TOKEN`: Your Docker Hub Access Token -**Required Environment Variables:** +**Environment Variables:** * `ENABLE_DOCKERHUB`: Set to `true` to enable Docker Hub push #### Environment Variables @@ -102,6 +135,8 @@ Configure the following environment variables in `docker-compose.yml`: | `LC_ALL` | `zh_CN.UTF-8` | Locale setting | | `CUSTOM_USER` | - | Custom username (recommended) | | `PASSWORD` | - | Web UI access password (recommended) | +| `AUTO_START_WECHAT` | `true` | Whether to automatically start the WeChat client | +| `AUTO_START_QQ` | `false` | Whether to automatically start the QQ client | #### Port Configuration diff --git a/root/defaults/menu.xml b/root/defaults/menu.xml index fe9f87f..8bc8504 100644 --- a/root/defaults/menu.xml +++ b/root/defaults/menu.xml @@ -2,7 +2,7 @@ /usr/bin/xterm -/scripts/wechat/wechat-restart.sh -/scripts/wechat/wechat-unminimize.sh +/scripts/wechat/wechat-restart.sh +/scripts/qq/qq-restart.sh diff --git a/root/scripts/qq/qq-restart.sh b/root/scripts/qq/qq-restart.sh new file mode 100755 index 0000000..1ff1e69 --- /dev/null +++ b/root/scripts/qq/qq-restart.sh @@ -0,0 +1,3 @@ +#!/bin/bash +pkill -9 -f /usr/bin/qq 2>/dev/null +nohup /usr/bin/qq --no-sandbox >/dev/null 2>&1 & \ No newline at end of file diff --git a/root/scripts/start.sh b/root/scripts/start.sh index a08f548..a6f914a 100755 --- a/root/scripts/start.sh +++ b/root/scripts/start.sh @@ -1,7 +1,32 @@ #!/bin/bash -# start WeChat application in the background if wechat exists -if [ -f /usr/bin/wechat ]; then nohup /usr/bin/wechat > /dev/null 2>&1 & fi +# configure openbox dock mode for stalonetray +if [ ! -f /config/.config/openbox/rc.xml ] || grep -A20 "" /config/.config/openbox/rc.xml | grep -q "no"; then + mkdir -p /config/.config/openbox + [ ! -f /config/.config/openbox/rc.xml ] && cp /etc/xdg/openbox/rc.xml /config/.config/openbox/ + sed -i '//,/<\/dock>/s/no<\/noStrut>/yes<\/noStrut>/' /config/.config/openbox/rc.xml + openbox --reconfigure +fi +# update openbox menu if differs from default +if [ ! -f /config/.config/openbox/menu.xml ] || ! cmp /defaults/menu.xml /config/.config/openbox/menu.xml; then + mkdir -p /config/.config/openbox + cp /defaults/menu.xml /config/.config/openbox/menu.xml + openbox --reconfigure +fi + +nohup stalonetray --dockapp-mode simple > /dev/null 2>&1 & + +# start WeChat application in the background if exists and auto-start enabled +if [ "$AUTO_START_WECHAT" = "true" ]; then + if [ -f /usr/bin/wechat ]; then nohup /usr/bin/wechat > /dev/null 2>&1 & fi +fi + +# start QQ application in the background if exists and auto-start enabled +if [ "$AUTO_START_QQ" = "true" ]; then + if [ -f /usr/bin/qq ]; then nohup /usr/bin/qq --no-sandbox > /dev/null 2>&1 & fi +fi + +# !deprecated: start window switcher application in the background # start window switcher application in the background -nohup sleep 2 && python /scripts/window_switcher.py > /dev/null 2>&1 & \ No newline at end of file +# nohup sleep 2 && python /scripts/window_switcher.py > /dev/null 2>&1 & diff --git a/root/wechat.png b/root/wechat.png deleted file mode 100644 index f9dd9b7..0000000 Binary files a/root/wechat.png and /dev/null differ