new-site/scripts/Dockerfile
justin 579919197d trucking: compute coupon discounted prices on the fly (true per A/B arm) + fix CTA URL bug
Two correctness fixes that gate enabling the coupon test:

1. On-the-fly pricing. The coupon block hardcoded '$79 $47' (only true at 40%
   off) — a false claim on the 20/30% arms. Now build_trucking_campaigns.py
   reads api/src/service-catalog.ts (same source checkout uses) and computes
   coupon_price_full / coupon_price_deal per recipient as full - round(full*pct/100),
   exactly matching the server. Service-fee-only; non-discountable services
   (boc3-filing passthrough) get NO price and fall back to percent-only copy.
   Quotes the service the email is ABOUT (mcs150 $79, reactivation $149), not the
   bundle the CTA happens to link to. service-catalog.ts now ships in the worker
   image; helper degrades to percent-only if it can't be read.

2. CTA URL bug (likely a big driver of the zero-click problem). Main campaign
   CTAs render '/order/slug&utm_source=...' (no '?') -> HTTP 404, verified live.
   Deficiency CTAs would double-'?' once a coupon added '?code='. lp_link now
   owns the query (?dot=...&code=...) so every template appends with a leading
   '&' and is valid in all 4 states (main/deficiency x coupon on/off), verified
   against live URLs returning 200.

Deficiency _deal_box now shows real was/now prices (percent-only for boc3).
Tests: 7/7 pass (adds URL-wellformed + price-matches-checkout cases).
2026-06-20 17:43:11 -05:00

42 lines
1.5 KiB
Docker

FROM python:3.12-slim
# Install LibreOffice for DOCX→PDF, Playwright deps, and system packages
RUN apt-get update && apt-get install -y --no-install-recommends \
libreoffice-writer \
fonts-liberation \
fonts-dejavu \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python dependencies
COPY scripts/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install Playwright browsers
RUN playwright install chromium && playwright install-deps chromium
# Copy all scripts
COPY scripts/ /app/scripts/
COPY docs/product-facts.md /app/docs/product-facts.md
# Authoritative service prices: build_trucking_campaigns.py reads this to compute
# coupon discounted prices that match what checkout charges (service-fee only).
COPY api/src/service-catalog.ts /app/api/src/service-catalog.ts
COPY ["docs/MCS-150 Form.pdf", "/app/docs/MCS-150 Form.pdf"]
COPY ["docs/MCS-150B Form.pdf", "/app/docs/MCS-150B Form.pdf"]
COPY ["docs/MCS-150C Form.pdf", "/app/docs/MCS-150C Form.pdf"]
COPY ["docs/CMS-855I Form.pdf", "/app/docs/CMS-855I Form.pdf"]
COPY ["docs/CMS-855B Form.pdf", "/app/docs/CMS-855B Form.pdf"]
COPY ["docs/CMS-855O Form.pdf", "/app/docs/CMS-855O Form.pdf"]
COPY ["docs/CMS-855A Form.pdf", "/app/docs/CMS-855A Form.pdf"]
COPY ["docs/SC COC Form.pdf", "/app/docs/SC COC Form.pdf"]
# Create data directories
RUN mkdir -p /app/data/screenshots /app/data/documents /app/data/logs
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
EXPOSE 8090
CMD ["python", "-m", "scripts.workers.job_server"]