fix: find better-sqlite3 native binding in pnpm store
pnpm uses .pnpm symlink store, so the binding isn't at the standard node_modules path. Use find to locate the .node file and copy it to where Nitro expects it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,13 +6,15 @@ COPY package.json pnpm-lock.yaml ./
|
|||||||
RUN pnpm install --frozen-lockfile
|
RUN pnpm install --frozen-lockfile
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN pnpm run build
|
RUN pnpm run build
|
||||||
|
# Copy better-sqlite3 native binding to where Nitro expects it
|
||||||
|
RUN find /app/node_modules/.pnpm -name "better_sqlite3.node" -path "*/Release/*" | head -1 | \
|
||||||
|
xargs -I{} sh -c 'mkdir -p .output/server/node_modules/better-sqlite3/build/Release && cp "{}" .output/server/node_modules/better-sqlite3/build/Release/'
|
||||||
|
|
||||||
FROM node:24-alpine AS run
|
FROM node:24-alpine AS run
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN mkdir -p /data && chown node:node /data
|
RUN mkdir -p /data && chown node:node /data
|
||||||
COPY --from=build /app/.output ./.output
|
COPY --from=build /app/.output ./.output
|
||||||
COPY --from=build /app/node_modules/better-sqlite3/build ./.output/server/node_modules/better-sqlite3/build
|
|
||||||
USER node
|
USER node
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=15s \
|
HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=15s \
|
||||||
|
|||||||
Reference in New Issue
Block a user