# aiw-voice-widget: embeddable JS bundle, served by nginx.
#
# A single bundle (aiw-voice-widget.js) serves both dev and prod environments —
# the customer's <script> tag carries data-backend-url and data-widget-token, so
# we don't bake env-specific URLs into the bundle.
#
# SOP for deploys (locked in 2026-05-04):
#   1. Edit src/ locally
#   2. `npm run build` → produces dist/aiw-voice-widget.js
#   3. `git add aiw-voice-widget/{src,dist} && git commit && git push`
#   4. On VPS: `cd /opt/aiw/<env> && git -C /opt/aiw/src pull \
#       && docker compose build widget && docker compose up -d widget`
#
# This image does NOT rebuild the bundle — it ships the committed dist/ file
# verbatim. That guarantees the deployed bytes exactly match what was tested
# locally and avoids esbuild version drift inside the Docker builder.

FROM nginx:alpine
WORKDIR /usr/share/nginx/html

COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY dist/aiw-voice-widget.js ./aiw-voice-widget.js

EXPOSE 80
