Full-stack Next.js 16 app with three scraping pipelines: - AirScale CSV → Anymailfinder Bulk Decision Maker search - LinkedIn Sales Navigator → Vayne → Anymailfinder email enrichment - Apify Google SERP → domain extraction → Anymailfinder bulk enrichment Includes Docker multi-stage build + docker-compose for Coolify deployment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
74 lines
2.7 KiB
Docker
74 lines
2.7 KiB
Docker
# ──────────────────────────────────────────────
|
|
# Stage 1: Install dependencies
|
|
# ──────────────────────────────────────────────
|
|
FROM node:22-alpine AS deps
|
|
WORKDIR /app
|
|
|
|
# Install native build tools needed for better-sqlite3
|
|
RUN apk add --no-cache python3 make g++
|
|
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
# ──────────────────────────────────────────────
|
|
# Stage 2: Build the application
|
|
# ──────────────────────────────────────────────
|
|
FROM node:22-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
RUN apk add --no-cache python3 make g++
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
# Generate Prisma client
|
|
RUN npx prisma generate
|
|
|
|
# Build Next.js (output: standalone)
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
RUN npm run build
|
|
|
|
# ──────────────────────────────────────────────
|
|
# Stage 3: Production runtime
|
|
# ──────────────────────────────────────────────
|
|
FROM node:22-alpine AS runner
|
|
WORKDIR /app
|
|
|
|
RUN apk add --no-cache python3 make g++
|
|
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV PORT=3000
|
|
ENV HOSTNAME=0.0.0.0
|
|
|
|
# Non-root user for security
|
|
RUN addgroup --system --gid 1001 nodejs \
|
|
&& adduser --system --uid 1001 nextjs
|
|
|
|
# Copy standalone output
|
|
COPY --from=builder /app/.next/standalone ./
|
|
COPY --from=builder /app/.next/static ./.next/static
|
|
COPY --from=builder /app/public ./public
|
|
|
|
# Copy Prisma files (schema + migrations + generated client)
|
|
COPY --from=builder /app/prisma ./prisma
|
|
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
|
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
|
COPY --from=builder /app/node_modules/better-sqlite3 ./node_modules/better-sqlite3
|
|
COPY --from=builder /app/node_modules/@prisma/adapter-better-sqlite3 ./node_modules/@prisma/adapter-better-sqlite3
|
|
COPY --from=builder /app/node_modules/@prisma/driver-adapter-utils ./node_modules/@prisma/driver-adapter-utils
|
|
COPY --from=builder /app/node_modules/prisma ./node_modules/prisma
|
|
|
|
# Entrypoint script that runs migrations then starts the app
|
|
COPY docker-entrypoint.sh ./
|
|
RUN chmod +x docker-entrypoint.sh
|
|
|
|
# Data directory for SQLite — must be a volume
|
|
RUN mkdir -p /data && chown nextjs:nodejs /data
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
|
|
ENTRYPOINT ["./docker-entrypoint.sh"]
|