diff --git a/Dockerfile b/Dockerfile index 2ba17c2..1a68ca6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,18 +44,26 @@ COPY --from=builder /app/src/generated ./src/generated # Install runtime deps needed for migrations + seed. The Next.js standalone # bundle covers the app itself, but the seed script (prisma/seed-dow.ts) is -# a separate .ts file executed via tsx and needs its own module graph: +# a separate .ts file executed via tsx. +# +# tsx is installed GLOBALLY (lives at /usr/local/bin/tsx, on PATH +# unconditionally). Installing it locally via `npm install --no-save tsx` +# doesn't work reliably here because Next.js's standalone node_modules +# layout aggressively reshuffles its own tree — the tsx binary was +# repeatedly going missing from node_modules/.bin after what npm reported +# as a successful install. Global install sidesteps that entirely. +# +# Other deps are local (alongside the standalone tree): # prisma — the migrate-deploy CLI # dotenv — prisma.config.ts imports dotenv/config -# tsx — runs the seed without an ahead-of-time compile # @prisma/adapter-pg — the driver the seed instantiates directly # bcryptjs — the seed hashes the admin's temp password -RUN npm install --no-save \ - prisma@7.4.2 \ - dotenv@17.3.1 \ - tsx@4 \ - @prisma/adapter-pg@7.4.2 \ - bcryptjs@3 +RUN npm install -g tsx@4 && \ + npm install --no-save \ + prisma@7.4.2 \ + dotenv@17.3.1 \ + @prisma/adapter-pg@7.4.2 \ + bcryptjs@3 # Create uploads directories for media storage RUN mkdir -p /data/uploads && chown nextjs:nodejs /data/uploads