Files
brainstorming/Dockerfile
Alejandro Martinez 0728211857 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) <noreply@anthropic.com>
2026-04-07 14:23:07 +02:00

21 lines
673 B
Docker

FROM node:24-alpine AS build
RUN apk add --no-cache python3 make g++
WORKDIR /app
RUN corepack enable pnpm
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm run build
FROM node:24-alpine AS run
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 \
CMD wget -q --spider http://localhost:3000/api/health || exit 1
ENTRYPOINT ["node", ".output/server/index.mjs"]