All checks were successful
Build and Push Docker Images / docker (push) Successful in 46s
CRITICAL FIX: - Frontend now loads environment variables at runtime instead of build time - This allows changing configuration without rebuilding the Docker image CHANGES: - Add env-config.js script loader to index.html - Update env.sh to use correct path for serve (/app/dist) - Update Dockerfile to run env.sh before starting serve - Add VITE_STRIPE_PUBLISHABLE_KEY to docker-compose environment HOW IT WORKS: 1. env.sh reads VITE_* variables from container environment 2. Generates /app/dist/env-config.js with window.env object 3. index.html loads env-config.js before React app 4. src/utils/config.ts reads from window.env at runtime This fixes the "Missing required environment variable: WREN_API_TOKEN" error because the frontend can now access environment variables passed to the container. 🔒 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
58 lines
1.6 KiB
YAML
58 lines
1.6 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# Frontend - Vite React App (static files served by host Nginx)
|
|
web:
|
|
image: code.puffinoffset.com/matt/puffin-app:frontend-latest
|
|
container_name: puffin-frontend
|
|
ports:
|
|
- "3800:3000"
|
|
environment:
|
|
- NODE_ENV=production
|
|
- VITE_API_BASE_URL=${VITE_API_BASE_URL:-https://api.puffinoffset.com}
|
|
- VITE_WREN_API_TOKEN=${VITE_WREN_API_TOKEN}
|
|
- VITE_FORMSPREE_CONTACT_ID=${VITE_FORMSPREE_CONTACT_ID}
|
|
- VITE_FORMSPREE_OFFSET_ID=${VITE_FORMSPREE_OFFSET_ID}
|
|
- VITE_STRIPE_PUBLISHABLE_KEY=${VITE_STRIPE_PUBLISHABLE_KEY}
|
|
restart: unless-stopped
|
|
networks:
|
|
- puffin-network
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
|
|
# Backend - Express API Server
|
|
backend:
|
|
image: code.puffinoffset.com/matt/puffin-app:backend-latest
|
|
container_name: puffin-backend
|
|
ports:
|
|
- "3801:3001"
|
|
volumes:
|
|
- puffin-data:/app/data
|
|
environment:
|
|
- NODE_ENV=production
|
|
- PORT=3001
|
|
- FRONTEND_URL=${FRONTEND_URL:-https://puffinoffset.com}
|
|
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
|
|
- STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
|
|
- WREN_API_TOKEN=${WREN_API_TOKEN}
|
|
- WREN_DRY_RUN=${WREN_DRY_RUN:-false}
|
|
- DATABASE_PATH=/app/data/orders.db
|
|
networks:
|
|
- puffin-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
networks:
|
|
puffin-network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
puffin-data:
|
|
driver: local
|