mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
[monorepo] avoid corepack network requests (#33502)
* [monorepo] avoid corepack network requests - Download yarn via corepack as the first step in all the docker files - Turn off networking in corepack - Do not run things in the upstream node image Instead, use the monorepo image, or base layer in all the services. - Always build the base layer when running tests (uses cache) * [monorepo] install corepack in shared place * [clsi-lb] remove unrelated changes * [web] add missing DC_RUN_FLAGS * [monorepo] only rebuild test images locally Also remove spurious build config in docker-compose.ci.yml. * [server-ce] test: make yarn files available to host-admin and e2e * [monorepo] put the corepack install snippet in a few more places GitOrigin-RevId: 38005016ae5a708e12295e246269d6c18fece937
This commit is contained in:
@@ -15,8 +15,11 @@ COPY server-ce/genScript.js server-ce/services.js /overleaf/
|
||||
|
||||
# Pre-install yarn via corepack so it is available at runtime for all users
|
||||
# -------------------------------------------------------------------------
|
||||
# Corepack setup, shared between all the images.
|
||||
ENV PATH="/overleaf/node_modules/.bin:$PATH"
|
||||
ENV COREPACK_HOME=/opt/corepack
|
||||
RUN corepack install
|
||||
RUN corepack enable && corepack install -g yarn@4.14.1
|
||||
ENV COREPACK_ENABLE_NETWORK=0
|
||||
|
||||
# Install yarn dependencies
|
||||
# -------------------------
|
||||
|
||||
@@ -33,7 +33,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y nodejs \
|
||||
&& corepack enable \
|
||||
\
|
||||
&& rm -rf \
|
||||
# We are adding a custom nginx config in the main Dockerfile.
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
FROM node:24.14.1
|
||||
|
||||
# Corepack setup, shared between all the images.
|
||||
ENV PATH="/overleaf/node_modules/.bin:$PATH"
|
||||
ENV COREPACK_HOME=/opt/corepack
|
||||
RUN corepack enable && corepack install -g yarn@4.14.1
|
||||
ENV COREPACK_ENABLE_NETWORK=0
|
||||
|
||||
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \
|
||||
&& echo \
|
||||
"deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
|
||||
|
||||
@@ -47,7 +47,7 @@ test-e2e-native-linux:
|
||||
docker compose -f docker-compose.yml -f docker-compose.native.yml up --no-log-prefix cypress
|
||||
|
||||
test-e2e:
|
||||
docker compose build host-admin
|
||||
docker compose build host-admin e2e
|
||||
docker compose up --detach --wait host-admin
|
||||
docker compose up --detach --wait mongo
|
||||
docker compose up --no-log-prefix --exit-code-from=e2e e2e host-admin
|
||||
@@ -81,7 +81,7 @@ prefetch_default_compose:
|
||||
|
||||
prefetch_default: prefetch_default_compose_build
|
||||
prefetch_default_compose_build:
|
||||
docker compose build host-admin
|
||||
docker compose build host-admin e2e
|
||||
|
||||
prefetch: prefetch_custom
|
||||
prefetch_custom: prefetch_custom_compose_pull
|
||||
|
||||
@@ -80,6 +80,10 @@ services:
|
||||
- $PWD:$PWD
|
||||
- $MONOREPO/libraries:$MONOREPO/libraries:ro
|
||||
- $MONOREPO/node_modules:$MONOREPO/node_modules:ro
|
||||
- $MONOREPO/.yarn:$MONOREPO/.yarn:ro
|
||||
- $MONOREPO/.yarnrc.yml:$MONOREPO/.yarnrc.yml:ro
|
||||
- $MONOREPO/package.json:$MONOREPO/package.json:ro
|
||||
- $MONOREPO/yarn.lock:$MONOREPO/yarn.lock:ro
|
||||
environment:
|
||||
MONOREPO:
|
||||
CYPRESS_SHARD:
|
||||
@@ -110,6 +114,10 @@ services:
|
||||
- $PWD:$PWD
|
||||
- $MONOREPO/libraries:$MONOREPO/libraries:ro
|
||||
- $MONOREPO/node_modules:$MONOREPO/node_modules:ro
|
||||
- $MONOREPO/.yarn:$MONOREPO/.yarn:ro
|
||||
- $MONOREPO/.yarnrc.yml:$MONOREPO/.yarnrc.yml:ro
|
||||
- $MONOREPO/package.json:$MONOREPO/package.json:ro
|
||||
- $MONOREPO/yarn.lock:$MONOREPO/yarn.lock:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
stop_grace_period: 0s
|
||||
environment:
|
||||
|
||||
Reference in New Issue
Block a user