优化docker相关

This commit is contained in:
yml
2026-05-19 21:41:43 +08:00
parent 4429fb20d7
commit f157fbc87a
5 changed files with 33 additions and 133 deletions
+13 -8
View File
@@ -12,22 +12,27 @@ 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 \
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
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 \
&& apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates python3 python3-pip tzdata xauth x11vnc novnc websockify \
&& ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo ${TZ} > /etc/timezone \
&& rm -rf /var/lib/apt/lists/*
&& echo ${TZ} > /etc/timezone
COPY apps/backend/package.json apps/backend/package-lock.json ./
RUN --mount=type=cache,target=/root/.npm npm ci
RUN PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright/ npx playwright install --with-deps chromium
RUN --mount=type=cache,target=/ms-playwright-cache,sharing=locked \
PLAYWRIGHT_BROWSERS_PATH=/ms-playwright-cache \
PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright/ \
npx playwright install --with-deps chromium \
&& cp -r /ms-playwright-cache /ms-playwright
COPY apps/backend/subservices/ocr-worker/ ./subservices/ocr-worker/
RUN python3 -m pip install --no-cache-dir --break-system-packages ./subservices/ocr-worker
RUN --mount=type=cache,target=/root/.cache/pip,sharing=locked \
python3 -m pip install --break-system-packages ./subservices/ocr-worker
COPY apps/backend/ ./
+2 -1
View File
@@ -8,7 +8,8 @@ ENV NPM_CONFIG_REGISTRY=${NPM_REGISTRY}
WORKDIR /app
COPY apps/frontend/package.json apps/frontend/package-lock.json ./
RUN npm install
RUN --mount=type=cache,target=/root/.npm,sharing=locked \
npm ci
COPY apps/frontend/ ./
RUN npm run build