@@ -783,11 +783,10 @@ ${postInstallCommands}
783783# node_modules may not exist when there are no dependencies to install
784784RUN mkdir -p node_modules
785785
786- # App files without node_modules, so the final stage can layer them separately
787786FROM build AS code
788787
789- # u+w first: rm as a non-root user fails on read-only directories
790- RUN chmod -R u+w node_modules && rm -rf node_modules
788+ # u+rwX first: non-root rm fails on read-only or non-traversable directories
789+ RUN chmod -R u+rwX node_modules && rm -rf node_modules
791790
792791FROM build AS indexer
793792
@@ -840,11 +839,9 @@ ENV TRIGGER_PROJECT_ID=\${TRIGGER_PROJECT_ID} \
840839 NODE_EXTRA_CA_CERTS=\${NODE_EXTRA_CA_CERTS} \
841840 NODE_ENV=production
842841
843- # Dependencies as their own layer: unchanged deps produce an identical blob
844- # that registries and workers already have, so repeat deploys skip it
842+ # Unchanged dependencies produce an identical layer that repeat deploys skip
845843COPY --from=build --chown=bun:bun /app/node_modules ./node_modules
846844
847- # Copy the app files (without node_modules) from the code stage
848845COPY --from=code --chown=bun:bun /app ./
849846
850847# Copy the index.json file from the indexer stage
@@ -904,11 +901,10 @@ COPY --chown=node:node . .
904901# node_modules may not exist when there are no dependencies to install
905902RUN mkdir -p node_modules
906903
907- # App files without node_modules, so the final stage can layer them separately
908904FROM build AS code
909905
910- # u+w first: rm as a non-root user fails on read-only directories
911- RUN chmod -R u+w node_modules && rm -rf node_modules
906+ # u+rwX first: non-root rm fails on read-only or non-traversable directories
907+ RUN chmod -R u+rwX node_modules && rm -rf node_modules
912908
913909FROM build AS indexer
914910
@@ -963,11 +959,9 @@ ENV TRIGGER_PROJECT_ID=\${TRIGGER_PROJECT_ID} \
963959 NODE_EXTRA_CA_CERTS=\${NODE_EXTRA_CA_CERTS} \
964960 NODE_ENV=production
965961
966- # Dependencies as their own layer: unchanged deps produce an identical blob
967- # that registries and workers already have, so repeat deploys skip it
962+ # Unchanged dependencies produce an identical layer that repeat deploys skip
968963COPY --from=build --chown=node:node /app/node_modules ./node_modules
969964
970- # Copy the app files (without node_modules) from the code stage
971965COPY --from=code --chown=node:node /app ./
972966
973967# Copy the index.json file from the indexer stage
0 commit comments