Files
x-newsletter/docker/Dockerfile
ksalk b3643fd5b0 Initial commit: Daily tech newsletter worker
A Node.js/TypeScript worker that sends daily AI-generated summaries
of tech news from X/Twitter via Nitter RSS feeds.

Features:
- Fetches tweets from 40+ curated tech accounts via Nitter RSS
- Filters and categorizes by topic (AI/ML, SWE, General Tech)
- Generates AI summaries using OpenRouter (Claude/GPT-4)
- Sends professional HTML email via Brevo SMTP
- Runs on cron schedule inside Docker container
- Instance rotation for Nitter reliability
- Graceful degradation if AI fails

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 20:23:38 +00:00

43 lines
1.1 KiB
Docker

# =============================================================================
# Build Stage
# =============================================================================
FROM node:20-alpine AS builder
WORKDIR /app
# Install dependencies first (better layer caching)
COPY package*.json ./
RUN npm ci
# Copy source and build
COPY tsconfig.json ./
COPY src ./src
RUN npm run build
# Prune dev dependencies
RUN npm prune --production
# =============================================================================
# Production Stage
# =============================================================================
FROM node:20-alpine AS production
# Security: run as non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S newsletter -u 1001
WORKDIR /app
# Copy built application
COPY --from=builder --chown=newsletter:nodejs /app/node_modules ./node_modules
COPY --from=builder --chown=newsletter:nodejs /app/dist ./dist
COPY --from=builder --chown=newsletter:nodejs /app/package.json ./
USER newsletter
# Set timezone (can be overridden via env)
ENV TZ=Europe/Warsaw
# Default command
CMD ["node", "dist/index.js"]