MoYang303 commited on
Commit
27b8d93
·
verified ·
1 Parent(s): d200cd9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -4
Dockerfile CHANGED
@@ -7,7 +7,7 @@ ARG PIP_PACKAGES="matplotlib jmcomic browser_cookie3 img2pdf kwmatcher aiosqlite
7
 
8
  USER root
9
 
10
- # 1. 安装系统依赖
11
  RUN apt-get update && apt-get install -y \
12
  git \
13
  jq \
@@ -27,13 +27,30 @@ RUN apt-get update && apt-get install -y \
27
  libasound2 \
28
  libatspi2.0-0 \
29
  libwayland-client0 \
 
 
 
 
 
 
30
  ${APT_PACKAGES} \
31
  && rm -rf /var/lib/apt/lists/*
32
 
33
- # 2. 安装Python依赖
 
 
 
34
  RUN if [ ! -z "${PIP_PACKAGES}" ]; then pip install ${PIP_PACKAGES}; fi
35
 
36
- # 3. 安装Playwright浏览器(明确指定户目录
37
  ENV PLAYWRIGHT_BROWSERS_PATH=/app/ms-playwright
38
  RUN playwright install --with-deps firefox \
39
- && chmod -R 777 /app/ms-playwright
 
 
 
 
 
 
 
 
 
7
 
8
  USER root
9
 
10
+ # 1. 安装所有必要依赖(包含虚拟X服务器和字体库)
11
  RUN apt-get update && apt-get install -y \
12
  git \
13
  jq \
 
27
  libasound2 \
28
  libatspi2.0-0 \
29
  libwayland-client0 \
30
+ xvfb \
31
+ libpci-dev \
32
+ fonts-freefont-ttf \
33
+ fontconfig \
34
+ xauth \
35
+ dbus \
36
  ${APT_PACKAGES} \
37
  && rm -rf /var/lib/apt/lists/*
38
 
39
+ # 2. 配置缓存目录权限
40
+ RUN mkdir -p /.cache && chmod 777 /.cache
41
+
42
+ # 3. 安装Python依赖
43
  RUN if [ ! -z "${PIP_PACKAGES}" ]; then pip install ${PIP_PACKAGES}; fi
44
 
45
+ # 4. 安装Playwright浏览器(使虚拟显示
46
  ENV PLAYWRIGHT_BROWSERS_PATH=/app/ms-playwright
47
  RUN playwright install --with-deps firefox \
48
+ && chmod -R 777 /app/ms-playwright
49
+
50
+ # 5. 设置运行时环境变量
51
+ ENV DISPLAY=:99
52
+ ENV FONTCONFIG_PATH=/etc/fonts
53
+ ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
54
+
55
+ # 6. 切换非root用户(如果基础镜像支持)
56
+ USER 1000:1000