[server-ce] run npm install on minimal set of source files (#31111)

GitOrigin-RevId: 389acfb3e23533f5361f2cc0274b440d785a7179
This commit is contained in:
Jakob Ackermann
2026-01-29 08:40:43 +00:00
committed by Copybot
parent 9d625fc834
commit 3ddc20e424

View File

@@ -7,27 +7,25 @@ FROM $OVERLEAF_BASE_TAG
WORKDIR /overleaf WORKDIR /overleaf
# Add required source files # Add required source files for npm install
# ------------------------- # -----------------------------------------
ADD server-ce/genScript.js /overleaf/genScript.js COPY --parents libraries/*/package.json patches/ services/*/package.json tools/migrations/ package.json package-lock.json /overleaf/
ADD server-ce/services.js /overleaf/services.js COPY server-ce/genScript.js server-ce/services.js /overleaf/
ADD package.json package-lock.json /overleaf/
ADD libraries/ /overleaf/libraries/
ADD services/ /overleaf/services/
ADD tools/migrations/ /overleaf/tools/migrations/
# Add npm patches # Install npm dependencies
# -----------------------
ADD patches/ /overleaf/patches
# Install npm dependencies and build webpack assets
# ------------------------ # ------------------------
RUN --mount=type=cache,target=/root/.cache \ RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/.npm \ --mount=type=cache,target=/root/.npm \
--mount=type=cache,target=/overleaf/services/web/node_modules/.cache,id=server-ce-webpack-cache \ --mount=type=cache,target=/overleaf/services/web/node_modules/.cache,id=server-ce-webpack-cache \
--mount=type=tmpfs,target=/tmp true \ --mount=type=tmpfs,target=/tmp node genScript install | bash
&& node genScript install | bash \
&& node genScript compile | bash # Add the actual source files
# ---------------------------
COPY --parents libraries/ services/ tools/migrations/ /overleaf/
RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/.npm \
--mount=type=cache,target=/overleaf/services/web/node_modules/.cache,id=server-ce-webpack-cache \
--mount=type=tmpfs,target=/tmp node genScript compile | bash
# Copy runit service startup scripts to its location # Copy runit service startup scripts to its location
# -------------------------------------------------- # --------------------------------------------------