Two bugs fixed: 1. SMS echo loop: Telnyx delivers our own outbound messages back to the webhook, causing the system to process its own replies as new requests. Added isOwnNumber() check to skip messages from system phone numbers. 2. Sender authorization: Added findAuthorizedSite() to verify that the sender is in the allowedSenders list for the receiving phone number, preventing unauthorized messages from being processed. 3. Empty manifest: The server Dockerfile runs from /app/server/ but REPO_ROOT defaulted to '.', causing content/sections/ to resolve to /app/server/content/sections/ (doesn't exist) instead of /app/content/sections/. Added ENV REPO_ROOT=/app to the Dockerfile. Added new sms/config.ts module that loads config/sms-sites.json at runtime (with 60-second cache) and provides isOwnNumber() and findAuthorizedSite() checks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
28 lines
554 B
Docker
28 lines
554 B
Docker
FROM node:22-alpine AS base
|
|
|
|
WORKDIR /app
|
|
|
|
# Install deps (build from repo root so shared/ resolves)
|
|
COPY package.json package-lock.json* ./
|
|
COPY shared/package.json shared/
|
|
COPY server/package.json server/
|
|
RUN npm install --ignore-scripts
|
|
|
|
# Rebuild native modules (better-sqlite3)
|
|
RUN npm rebuild better-sqlite3
|
|
|
|
# Copy source
|
|
COPY shared ./shared
|
|
COPY server ./server
|
|
COPY site-context.json ./
|
|
COPY content ./content
|
|
COPY config ./config
|
|
|
|
WORKDIR /app/server
|
|
|
|
ENV NODE_ENV=production
|
|
ENV REPO_ROOT=/app
|
|
EXPOSE 3001
|
|
|
|
CMD ["npx", "tsx", "src/index.ts"]
|