| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- FROM node:20-slim AS base
- # Install build tools for native addons (better-sqlite3)
- RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
- WORKDIR /app
- # Install dependencies
- COPY package.json package-lock.json* ./
- RUN npm ci
- # Copy source
- COPY . .
- # Build
- RUN npm run build
- # --- Production stage ---
- FROM node:20-slim AS runner
- RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
- WORKDIR /app
- ENV NODE_ENV=production
- ENV NEXT_TELEMETRY_DISABLED=1
- # Copy built app
- COPY --from=base /app/package.json ./
- COPY --from=base /app/package-lock.json* ./
- COPY --from=base /app/next.config.ts ./
- COPY --from=base /app/.next ./.next
- COPY --from=base /app/public ./public
- COPY --from=base /app/node_modules ./node_modules
- # Data directory for SQLite
- RUN mkdir -p /app/data
- EXPOSE 3000
- CMD ["npm", "start"]
|