fix: copy node_modules to Docker container for better-sqlite3 native dependencies

This commit is contained in:
Marko Djordjevic 2026-02-12 15:32:19 +01:00
parent 8646777f8d
commit 4e13648ebf
2 changed files with 7 additions and 1 deletions

View file

@ -16,12 +16,18 @@ FROM node:20-alpine
WORKDIR /app
# Install build dependencies for better-sqlite3
RUN apk add --no-cache python3 make g++
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Copy node_modules for native dependencies like better-sqlite3
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
RUN mkdir -p /app/public /app/data && chown -R nextjs:nodejs /app/public /app/data
ENV NODE_ENV=production PORT=3000 HOSTNAME=0.0.0.0