Update Dockerfile
Browse files- Dockerfile +11 -12
Dockerfile
CHANGED
|
@@ -28,30 +28,29 @@ COPY --from=builder /*.deb /
|
|
| 28 |
COPY --from=chrome-downloader /opt/chrome-linux64 /opt/chrome
|
| 29 |
COPY --from=chrome-downloader /opt/chromedriver-linux64/chromedriver /usr/bin/chromedriver
|
| 30 |
|
|
|
|
|
|
|
| 31 |
RUN dpkg -i /libgl1-mesa-dri.deb && dpkg -i /adwaita-icon-theme.deb \
|
| 32 |
&& apt-get update \
|
| 33 |
-
&& apt-get install -y --no-install-recommends \
|
| 34 |
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \
|
| 35 |
libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 \
|
| 36 |
libgbm1 libasound2 libpango-1.0-0 libcairo2 libatspi2.0-0 \
|
| 37 |
libwayland-client0 libglib2.0-0 libdbus-1-3 \
|
| 38 |
libx11-6 libxcb1 libxext6 libfontconfig1 libfreetype6 libexpat1 \
|
| 39 |
-
# 字体(fingerprint 优化)
|
| 40 |
fonts-liberation fonts-liberation2 fonts-noto-color-emoji \
|
| 41 |
-
fonts-
|
| 42 |
-
# D-Bus(Chrome 功能完整性)
|
| 43 |
dbus dbus-x11 \
|
| 44 |
-
# 时区
|
| 45 |
tzdata \
|
| 46 |
-
# 语言
|
| 47 |
locales \
|
| 48 |
xvfb dumb-init git procps curl xauth \
|
| 49 |
-
&& locale-gen en_US.UTF-8 \
|
| 50 |
-
&& update-locale LANG=en_US.UTF-8 \
|
| 51 |
&& rm -rf /var/lib/apt/lists/* \
|
|
|
|
|
|
|
|
|
|
| 52 |
&& chmod a+rx /opt/chrome/chrome /usr/bin/chromedriver
|
| 53 |
|
| 54 |
-
# wrapper
|
| 55 |
RUN printf '#!/bin/bash\n\
|
| 56 |
exec /opt/chrome/chrome \\\n\
|
| 57 |
--no-sandbox \\\n\
|
|
@@ -77,7 +76,6 @@ RUN useradd -m -u 1000 user
|
|
| 77 |
|
| 78 |
WORKDIR /app
|
| 79 |
|
| 80 |
-
# 优化构建缓存:先克隆再分层安装
|
| 81 |
RUN git clone --depth=1 https://github.com/FlareSolverr/FlareSolverr.git /tmp/fs \
|
| 82 |
&& cp /tmp/fs/requirements.txt .
|
| 83 |
|
|
@@ -91,17 +89,18 @@ RUN cp -r /tmp/fs/. . && rm -rf /tmp/fs \
|
|
| 91 |
USER user
|
| 92 |
RUN mkdir -p "/home/user/.config/chromium/Crash Reports/pending"
|
| 93 |
|
|
|
|
| 94 |
ENV PORT=7860 \
|
| 95 |
HEADLESS=false \
|
| 96 |
DISPLAY=:99 \
|
| 97 |
BROWSER_EXECUTABLE_PATH=/usr/local/bin/google-chrome \
|
| 98 |
BROWSER_TIMEOUT=60000 \
|
| 99 |
LOG_LEVEL=info \
|
| 100 |
-
|
| 101 |
LANG=en_US.UTF-8 \
|
| 102 |
LC_ALL=en_US.UTF-8 \
|
| 103 |
LANGUAGE=en_US:en \
|
| 104 |
-
|
| 105 |
|
| 106 |
EXPOSE 7860
|
| 107 |
|
|
|
|
| 28 |
COPY --from=chrome-downloader /opt/chrome-linux64 /opt/chrome
|
| 29 |
COPY --from=chrome-downloader /opt/chromedriver-linux64/chromedriver /usr/bin/chromedriver
|
| 30 |
|
| 31 |
+
# ★ 修复关键:locale 生成必须在同一个 RUN 里设置 DEBIAN_FRONTEND 和 LANG,
|
| 32 |
+
# 且绝对不能调用 update-locale(Docker build 阶段无效会直接 exit 255)
|
| 33 |
RUN dpkg -i /libgl1-mesa-dri.deb && dpkg -i /adwaita-icon-theme.deb \
|
| 34 |
&& apt-get update \
|
| 35 |
+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
| 36 |
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \
|
| 37 |
libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 \
|
| 38 |
libgbm1 libasound2 libpango-1.0-0 libcairo2 libatspi2.0-0 \
|
| 39 |
libwayland-client0 libglib2.0-0 libdbus-1-3 \
|
| 40 |
libx11-6 libxcb1 libxext6 libfontconfig1 libfreetype6 libexpat1 \
|
|
|
|
| 41 |
fonts-liberation fonts-liberation2 fonts-noto-color-emoji \
|
| 42 |
+
fonts-dejavu-core fonts-freefont-ttf \
|
|
|
|
| 43 |
dbus dbus-x11 \
|
|
|
|
| 44 |
tzdata \
|
|
|
|
| 45 |
locales \
|
| 46 |
xvfb dumb-init git procps curl xauth \
|
|
|
|
|
|
|
| 47 |
&& rm -rf /var/lib/apt/lists/* \
|
| 48 |
+
# ★ 修复:locale-gen 单独运行,不接 update-locale
|
| 49 |
+
&& sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
|
| 50 |
+
&& locale-gen \
|
| 51 |
&& chmod a+rx /opt/chrome/chrome /usr/bin/chromedriver
|
| 52 |
|
| 53 |
+
# wrapper
|
| 54 |
RUN printf '#!/bin/bash\n\
|
| 55 |
exec /opt/chrome/chrome \\\n\
|
| 56 |
--no-sandbox \\\n\
|
|
|
|
| 76 |
|
| 77 |
WORKDIR /app
|
| 78 |
|
|
|
|
| 79 |
RUN git clone --depth=1 https://github.com/FlareSolverr/FlareSolverr.git /tmp/fs \
|
| 80 |
&& cp /tmp/fs/requirements.txt .
|
| 81 |
|
|
|
|
| 89 |
USER user
|
| 90 |
RUN mkdir -p "/home/user/.config/chromium/Crash Reports/pending"
|
| 91 |
|
| 92 |
+
# ★ 修复:locale 通过 ENV 声明,不依赖 update-locale 命令
|
| 93 |
ENV PORT=7860 \
|
| 94 |
HEADLESS=false \
|
| 95 |
DISPLAY=:99 \
|
| 96 |
BROWSER_EXECUTABLE_PATH=/usr/local/bin/google-chrome \
|
| 97 |
BROWSER_TIMEOUT=60000 \
|
| 98 |
LOG_LEVEL=info \
|
| 99 |
+
TZ=America/New_York \
|
| 100 |
LANG=en_US.UTF-8 \
|
| 101 |
LC_ALL=en_US.UTF-8 \
|
| 102 |
LANGUAGE=en_US:en \
|
| 103 |
+
DEBIAN_FRONTEND=noninteractive
|
| 104 |
|
| 105 |
EXPOSE 7860
|
| 106 |
|