From 0728211857b31223da523df932a3f254008ffd44 Mon Sep 17 00:00:00 2001 From: Alejandro Martinez Date: Tue, 7 Apr 2026 14:23:07 +0200 Subject: [PATCH] fix: copy better-sqlite3 native bindings to Docker runtime stage The .node binary wasn't being copied to .output, causing 'Could not locate the bindings file' error at runtime. Co-Authored-By: Claude Opus 4.6 (1M context) --- Dockerfile | 1 + nuxt.config.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index 6ac2a23..964b469 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ ENV NODE_ENV=production WORKDIR /app RUN mkdir -p /data && chown node:node /data COPY --from=build /app/.output ./.output +COPY --from=build /app/node_modules/better-sqlite3/build ./.output/server/node_modules/better-sqlite3/build USER node EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=15s \ diff --git a/nuxt.config.ts b/nuxt.config.ts index 49b41ae..637407f 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -10,5 +10,8 @@ export default defineNuxtConfig({ nitro: { experimental: { tasks: true }, + externals: { + external: ['better-sqlite3'], + }, }, })