Files
AetherTable/Dockerfile.client
T
John SmithandClaude c8cf376feb feat(infra): coturn TURN service + PeerJS ICE plumbing (iteration 26)
coturn 4.17.2-alpine with static-auth-secret mode (secret via env, never
in client bundles), STUN+TURN on 3478, relay range 49160-49200. Client
buildIceServers(): public STUN default, TURN appended only when all
VITE_TURN_* vars set; typed env + compose build args. Honest limits
documented: NAT traversal itself unverifiable locally; TLS/DTLS deferred.
9 new tests; vitest 168/14.

Co-Authored-By: Claude <[email protected]>
2026-08-25 01:32:30 -04:00

80 lines
2.3 KiB
Docker

# ============================================================================
# Multi-Stage Build for React 18 + Vite Client & Nginx Proxy (:3000)
# ============================================================================
FROM node:22-alpine as builder
WORKDIR /app
# ICE-server plumbing for the WebRTC mesh (client/src/render/webrtc_mesh.ts).
# Declared so `docker compose build vtt-client` build args actually reach
# Vite as environment variables. Empty by default => STUN-only bundle.
# No hardcoded credentials anywhere; values come from compose/host env.
ARG VITE_PEERJS_URL=http://localhost:9000
ARG VITE_PEERJS_ROOM=aethertable-live
ARG VITE_YSYNC_WS_URL=ws://localhost:6380
ARG VITE_TURN_URL
ARG VITE_TURN_USERNAME
ARG VITE_TURN_CREDENTIAL
COPY client/package*.json ./
RUN npm install
COPY client ./
RUN npm run build
# Nginx Production Serving Layer
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
RUN rm -f /etc/nginx/conf.d/default.conf
COPY <<-'EOF_NGINX' /etc/nginx/conf.d/default.conf
server {
listen 3000;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
# Authoritative Rust Engine Proxy
location /api/ {
proxy_pass http://vtt-engine:8088/api/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Python Multi-Agent Orchestrator Proxy
location /api/v1/ {
proxy_pass http://vtt-orchestrator:8000/api/v1/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Rust WebSocket CRDT Relay
location /ws/ {
proxy_pass http://vtt-engine:8088/ws/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
EOF_NGINX
EXPOSE 3000
HEALTHCHECK --interval=5s --timeout=3s --retries=5 CMD wget -q --spider http://localhost:3000/ || exit 1
CMD ["nginx", "-g", "daemon off;"]