[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
# Add required source files
# -------------------------
ADD server-ce/genScript.js /overleaf/genScript.js
ADD server-ce/services.js /overleaf/services.js
ADD package.json package-lock.json /overleaf/
ADD libraries/ /overleaf/libraries/
ADD services/ /overleaf/services/
ADD tools/migrations/ /overleaf/tools/migrations/
# Add required source files for npm install
# -----------------------------------------
COPY --parents libraries/*/package.json patches/ services/*/package.json tools/migrations/ package.json package-lock.json /overleaf/
COPY server-ce/genScript.js server-ce/services.js /overleaf/
# Add npm patches
# -----------------------
ADD patches/ /overleaf/patches
# Install npm dependencies and build webpack assets
# Install npm dependencies
# ------------------------
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 true \
&& node genScript install | bash \
&& node genScript compile | bash
--mount=type=tmpfs,target=/tmp node genScript install | 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
# --------------------------------------------------