优化下载速度, 配置镜像站
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
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
|
||||
ARG TARGETARCH
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
||||
ENV UV_LINK_MODE=copy
|
||||
ENV UV_DEFAULT_INDEX=${UV_DEFAULT_INDEX}
|
||||
ENV PIP_INDEX_URL=${UV_DEFAULT_INDEX}
|
||||
ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN sed -i "s|http://deb.debian.org/debian|https://${DEBIAN_MIRROR}/debian|g" /etc/apt/sources.list.d/debian.sources \
|
||||
&& sed -i "s|http://security.debian.org/debian-security|https://${DEBIAN_MIRROR}/debian-security|g" /etc/apt/sources.list.d/debian.sources
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends curl ca-certificates python3 python3-pip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
@@ -16,7 +28,11 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
|
||||
COPY apps/backend/package.json apps/backend/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
RUN npx playwright install --with-deps chromium
|
||||
RUN if [ "${TARGETARCH}" = "amd64" ]; then \
|
||||
PLAYWRIGHT_DOWNLOAD_HOST="${PLAYWRIGHT_DOWNLOAD_HOST}" npx playwright install --with-deps chromium; \
|
||||
else \
|
||||
npx playwright install --with-deps chromium; \
|
||||
fi
|
||||
|
||||
COPY apps/backend/ ./
|
||||
|
||||
|
||||
Reference in New Issue
Block a user