Features: - Multi-channel notifications (Email + Telegram) - User-configurable notification settings per channel - Telegram bot integration with rich messages, location pins, and inline buttons - QR code generation for easy bot access (@myidbot support) - Admin UI for notification settings management - Test functionality for Telegram connection - Comprehensive documentation Implementation: - lib/telegram-service.ts: Telegram API integration - lib/notification-settings-db.ts: Database layer for user notification preferences - lib/geofence-notifications.ts: Extended for parallel multi-channel delivery - API routes for settings management and testing - Admin UI with QR code display and step-by-step instructions - Database table: UserNotificationSettings Documentation: - docs/telegram.md: Technical implementation guide - docs/telegram-anleitung.md: User guide with @myidbot instructions - docs/telegram-setup.md: Admin setup guide - README.md: Updated NPM scripts section Docker: - Updated Dockerfile to copy public directory - Added TELEGRAM_BOT_TOKEN environment variable - Integrated notification settings initialization in db:init 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
53 lines
1.1 KiB
Docker
53 lines
1.1 KiB
Docker
# Dockerfile für Location Tracker App mit MQTT Integration
|
|
|
|
FROM node:20-alpine AS base
|
|
|
|
# Installiere docker-cli für Mosquitto Container Management
|
|
RUN apk add --no-cache docker-cli
|
|
|
|
# Dependencies Stage
|
|
FROM base AS deps
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
# Builder Stage
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
# Build Next.js App
|
|
RUN npm run build
|
|
|
|
# Initialisiere Datenbanken (MQTT tables included in init-database.js)
|
|
RUN npm run db:init
|
|
|
|
# Runner Stage
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
# Kopiere nur Production Dependencies
|
|
COPY package*.json ./
|
|
RUN npm ci --omit=dev
|
|
|
|
# Kopiere Build Artifacts
|
|
COPY --from=builder /app/.next ./.next
|
|
COPY --from=builder /app/data ./data
|
|
COPY --from=builder /app/public ./public
|
|
|
|
# Kopiere App Code (benötigt für instrumentation.ts, lib/, etc.)
|
|
COPY --from=builder /app/instrumentation.ts ./
|
|
COPY --from=builder /app/lib ./lib
|
|
COPY --from=builder /app/scripts ./scripts
|
|
COPY --from=builder /app/next.config.js ./
|
|
COPY --from=builder /app/middleware.ts ./
|
|
|
|
# Exponiere Port
|
|
EXPOSE 3000
|
|
|
|
# Start App
|
|
CMD ["npm", "start"]
|