Ver Fonte

resolve symlinks

Yuki Takei há 3 semanas atrás
pai
commit
96384b3116
2 ficheiros alterados com 17 adições e 0 exclusões
  1. 8 0
      .github/workflows/reusable-app-prod.yml
  2. 9 0
      apps/app/docker/Dockerfile

+ 8 - 0
.github/workflows/reusable-app-prod.yml

@@ -63,6 +63,14 @@ jobs:
         pnpm deploy out --prod --legacy --filter @growi/app
         rm -rf apps/app/node_modules && mv out/node_modules apps/app/node_modules
 
+    - name: Resolve .next/node_modules symlinks
+      run: |
+        if [ -d apps/app/.next/node_modules ]; then
+          cp -rL apps/app/.next/node_modules apps/app/.next/node_modules_resolved
+          rm -rf apps/app/.next/node_modules
+          mv apps/app/.next/node_modules_resolved apps/app/.next/node_modules
+        fi
+
     - name: Archive production files
       id: archive-prod-files
       run: |

+ 9 - 0
apps/app/docker/Dockerfile

@@ -95,6 +95,15 @@ RUN pnpm deploy out --prod --legacy --filter @growi/app
 RUN rm -rf apps/app/node_modules && mv out/node_modules apps/app/node_modules
 RUN rm -rf apps/app/.next/cache
 
+# Resolve .next/node_modules symlinks to real files.
+# Turbopack generates symlinks pointing to the pnpm virtual store (node_modules/.pnpm/),
+# which will not exist in the release image.
+RUN if [ -d apps/app/.next/node_modules ]; then \
+      cp -rL apps/app/.next/node_modules apps/app/.next/node_modules_resolved && \
+      rm -rf apps/app/.next/node_modules && \
+      mv apps/app/.next/node_modules_resolved apps/app/.next/node_modules; \
+    fi
+
 # Stage artifacts into a clean directory for COPY --from
 RUN mkdir -p /tmp/release/apps/app && \
   cp package.json /tmp/release/ && \