Playwright固定官方镜像
This commit is contained in:
@@ -49,8 +49,8 @@ docker compose up -d
|
||||
|
||||
- Debian `apt` 使用腾讯云镜像
|
||||
- `npm` 使用 `npmmirror`
|
||||
- Playwright 浏览器默认先尝试 `npmmirror`,失败后自动回退官方源
|
||||
- `uv` 通过 `pip` 安装,`uv` / `pip` 使用腾讯云 PyPI 镜像
|
||||
- Playwright 浏览器固定使用官方源
|
||||
|
||||
如果你的服务器网络环境不同,也可以在构建时覆盖:
|
||||
|
||||
@@ -58,7 +58,6 @@ docker compose up -d
|
||||
docker compose build \
|
||||
--build-arg DEBIAN_MIRROR=mirrors.tuna.tsinghua.edu.cn \
|
||||
--build-arg NPM_REGISTRY=https://registry.npmjs.org \
|
||||
--build-arg PLAYWRIGHT_DOWNLOAD_HOST=https://playwright.azureedge.net \
|
||||
--build-arg UV_DEFAULT_INDEX=https://pypi.org/simple
|
||||
```
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ FROM node:22-bookworm
|
||||
|
||||
ARG DEBIAN_MIRROR=mirrors.cloud.tencent.com
|
||||
ARG NPM_REGISTRY=https://registry.npmmirror.com
|
||||
ARG PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright
|
||||
ARG UV_DEFAULT_INDEX=https://mirrors.cloud.tencent.com/pypi/simple
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
@@ -27,13 +26,7 @@ RUN python3 -m pip install --no-cache-dir --break-system-packages uv \
|
||||
COPY apps/backend/package.json apps/backend/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
RUN if [ -n "${PLAYWRIGHT_DOWNLOAD_HOST}" ]; then \
|
||||
echo "Trying Playwright mirror: ${PLAYWRIGHT_DOWNLOAD_HOST}"; \
|
||||
PLAYWRIGHT_DOWNLOAD_HOST="${PLAYWRIGHT_DOWNLOAD_HOST}" npx playwright install --with-deps chromium \
|
||||
|| (echo "Playwright mirror failed, falling back to official host" && npx playwright install --with-deps chromium); \
|
||||
else \
|
||||
npx playwright install --with-deps chromium; \
|
||||
fi
|
||||
RUN PLAYWRIGHT_DOWNLOAD_HOST= npx playwright install --with-deps chromium
|
||||
|
||||
COPY apps/backend/ ./
|
||||
|
||||
|
||||
+1
-2
@@ -78,8 +78,8 @@ docker compose up -d
|
||||
|
||||
- Debian `apt`:腾讯云镜像
|
||||
- `npm`:`npmmirror`
|
||||
- Playwright:默认先走 `npmmirror`,失败后自动回退官方源
|
||||
- `uv` 通过 `pip` 安装,`uv` / `pip` 使用腾讯云 PyPI 镜像
|
||||
- Playwright:固定使用官方源
|
||||
|
||||
如果你要切换成别的源,可以手动执行:
|
||||
|
||||
@@ -87,7 +87,6 @@ docker compose up -d
|
||||
docker compose build \
|
||||
--build-arg DEBIAN_MIRROR=mirrors.tuna.tsinghua.edu.cn \
|
||||
--build-arg NPM_REGISTRY=https://registry.npmmirror.com \
|
||||
--build-arg PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright \
|
||||
--build-arg UV_DEFAULT_INDEX=https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user