Commit cd3e3b0d authored by nanahira's avatar nanahira

finish novnc

parent db30e84d
Pipeline #3069 passed with stage
in 5 minutes and 20 seconds
...@@ -2,7 +2,7 @@ ARG BASE_IMAGE=git-registry.mycard.moe/nanahira/docker-mirai-cqhttp:x ...@@ -2,7 +2,7 @@ ARG BASE_IMAGE=git-registry.mycard.moe/nanahira/docker-mirai-cqhttp:x
FROM ${BASE_IMAGE} FROM ${BASE_IMAGE}
RUN apt update && \ RUN apt update && \
apt -y install python3 git x11vnc xvfb socat npm && \ apt -y install python3 git x11vnc xvfb socat fluxbox npm && \
npm install -g pm2 && \ npm install -g pm2 && \
git clone --depth=1 https://github.com/kanaka/noVNC.git /usr/src/noVNC && \ git clone --depth=1 https://github.com/kanaka/noVNC.git /usr/src/noVNC && \
git clone --depth=1 https://github.com/kanaka/websockify.git /usr/src/noVNC/utils/websockify \ git clone --depth=1 https://github.com/kanaka/websockify.git /usr/src/noVNC/utils/websockify \
...@@ -18,8 +18,9 @@ ENV HOME=/root \ ...@@ -18,8 +18,9 @@ ENV HOME=/root \
LANGUAGE=en_US.UTF-8 \ LANGUAGE=en_US.UTF-8 \
LC_ALL=C.UTF-8 \ LC_ALL=C.UTF-8 \
DISPLAY=:0.0 \ DISPLAY=:0.0 \
DISPLAY_WIDTH=425 \ DISPLAY_WIDTH=500 \
DISPLAY_HEIGHT=900 DISPLAY_HEIGHT=900 \
VNC_PASS=nanahira
#COPY ./novnc-supervisord.conf /etc/supervisor/conf.d/supervisord.conf #COPY ./novnc-supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ./pm2-novnc.json /usr/src/app/pm2-novnc.json COPY ./pm2-novnc.json /usr/src/app/pm2-novnc.json
......
...@@ -8,6 +8,30 @@ https://github.com/purerosefallen/docker-mirai-cqhttp ...@@ -8,6 +8,30 @@ https://github.com/purerosefallen/docker-mirai-cqhttp
## 建议 docker-compose ## 建议 docker-compose
### `novnc` 镜像
```yaml
version: '2.4'
services:
cqhttp:
restart: always
image: git-registry.mycard.moe/nanahira/docker-mirai-cqhttp:novnc
ports:
- '6700:6700'
volumes:
- ./data:/usr/src/app/data
- ./config:/usr/src/app/config
- ./bots:/usr/src/app/bots
environment:
QQ_ID: 11111111
QQ_PASS: change_me
WS_PORT: 6700
WS_TOKEN: change_me
VNC_PASS: change_me
```
### `x` 镜像
```yaml ```yaml
version: '2.4' version: '2.4'
services: services:
...@@ -30,7 +54,6 @@ services: ...@@ -30,7 +54,6 @@ services:
- ./config:/usr/src/app/config - ./config:/usr/src/app/config
- ./bots:/usr/src/app/bots - ./bots:/usr/src/app/bots
stdin_open: true stdin_open: true
command: java -jar mcl.jar
environment: environment:
DISPLAY: novnc:0.0 DISPLAY: novnc:0.0
QQ_ID: 11111111 QQ_ID: 11111111
...@@ -49,7 +72,9 @@ services: ...@@ -49,7 +72,9 @@ services:
* `latest` 无 GUI 镜像。需要有现成的 `devices.json` 文件。 * `latest` 无 GUI 镜像。需要有现成的 `devices.json` 文件。
* `x` **推荐。** 带 GUI 镜像,需要配合 noVNC 使用以拉滑块。 * `x` 带 GUI 镜像,需要配合 noVNC 使用以拉滑块。
* `novnc` 带 GUI 和 noVNC 镜像,可以直接拉滑块。noVNC 监听在 8080 端口。
## 环境变量 ## 环境变量
...@@ -61,6 +86,7 @@ ENV QQ_ID 11111111 ...@@ -61,6 +86,7 @@ ENV QQ_ID 11111111
ENV QQ_PASS qweqwe ENV QQ_PASS qweqwe
ENV WS_PORT 6700 ENV WS_PORT 6700
ENV WS_TOKEN qweqwe ENV WS_TOKEN qweqwe
ENV VNC_PASS nanahira
``` ```
### 说明 ### 说明
...@@ -74,3 +100,5 @@ ENV WS_TOKEN qweqwe ...@@ -74,3 +100,5 @@ ENV WS_TOKEN qweqwe
* `WS_PORT` Websocket 端口。 * `WS_PORT` Websocket 端口。
* `WS_TOKEN` Websocket 使用的密钥。 * `WS_TOKEN` Websocket 使用的密钥。
* `VNC_PASS` 仅限 `novnc` 镜像。noVNC 网页密码,默认 `nanahira`
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
}, },
{ {
"name": "x11vnc", "name": "x11vnc",
"script": "/usr/bin/x11vnc" "script": "bash",
"args": " -c '/usr/bin/x11vnc -passwd ${VNC_PASS}'"
}, },
{ {
"name": "novnc", "name": "novnc",
...@@ -20,6 +21,10 @@ ...@@ -20,6 +21,10 @@
"script": "socat", "script": "socat",
"args": "tcp-listen:6000,reuseaddr,fork unix:/tmp/.X11-unix/X0" "args": "tcp-listen:6000,reuseaddr,fork unix:/tmp/.X11-unix/X0"
}, },
{
"name": "fluxbox",
"script": "fluxbox"
},
{ {
"name": "mirai", "name": "mirai",
"script": "java", "script": "java",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment