build: 添加无头浏览器dockerfile

This commit is contained in:
lixiangwuxian 2024-10-13 14:41:08 +08:00
parent 1495ac516b
commit c0cfacbd33
3 changed files with 23 additions and 0 deletions

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
# 基于 chromedp/headless-shell 基础镜像
FROM chromedp/headless-shell:latest
# 安装 Noto 和 Noto CJK 字体
RUN sed -i 's@http://deb.debian.org@http://mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/debian.sources \
&& apt-get update -y \
&& apt-get install -y fonts-noto fonts-noto-cjk \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/

View File

@ -8,5 +8,6 @@ go build
# run
```shell
sudo docker-compose up --build -d
./qq_bot
```

13
docker-compose.yml Normal file
View File

@ -0,0 +1,13 @@
services:
headless-shell:
build:
context: .
dockerfile: Dockerfile
ports:
- "9222:9222"
command: >
--disable-gpu
--no-sandbox
--remote-debugging-address=0.0.0.0
--remote-debugging-port=9222
restart: unless-stopped