🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Fix server image crash: materialize @rybbit/shared symlink in builder
Bill Yang00a52750416b
diff --git a/.dockerignore b/.dockerignorenew file mode 100644index 000000000..d4cad6fb6--- /dev/null+++ b/.dockerignore@@ -0,0 +1,10 @@+# Keep host-side artifacts out of image builds: node_modules are installed+# inside the Dockerfiles (host copies are platform-mismatched on macOS),+# dist/.next are rebuilt inside, and stale *.tsbuildinfo can make tsc skip+# emitting into a dist the context no longer carries.+.git+**/node_modules+**/*.tsbuildinfo+client/.next+server/dist+shared/distdiff --git a/server/Dockerfile b/server/Dockerfileindex 079ea738b..910842374 100644--- a/server/Dockerfile+++ b/server/Dockerfile@@ -17,6 +17,15 @@ RUN npm ci --legacy-peer-deps# Copy server source codeCOPY server/ .+# npm installs the file:../shared dependency as a relative symlink+# (node_modules/@rybbit/shared -> ../../../shared). The runtime stage re-homes+# node_modules from /app/server to /app, which leaves that link pointing at+# /shared — outside the image. Materialize it into a real directory so the+# copied node_modules is location-independent.+RUN rm -rf node_modules/@rybbit/shared \+ && mkdir -p node_modules/@rybbit/shared \+ && cp -r /app/shared/package.json /app/shared/dist node_modules/@rybbit/shared/+# Build the applicationRUN npm run build@@ -50,7 +59,6 @@ COPY --from=builder /app/server/drizzle.config.ts ./drizzle.config.tsCOPY --from=builder /app/server/drizzle ./drizzleCOPY --from=builder /app/server/public ./publicCOPY --from=builder /app/server/src ./src-COPY --from=builder /app/shared ./shared# Make the entrypoint executableRUN chmod +x /docker-entrypoint.sh