feat: Add dynamic host IP detection for Docker Compose and Supabase config

- Add docker-compose.sh wrapper script that auto-detects host IP
- Update docker-compose.yml to use environment variable substitution
- Update Supabase config.toml files to use HOST_SITE_URL and SUPABASE_API_URL env vars
- Add scripts/get-host-ip.sh for IP detection
- Add scripts/set-host-env.sh for environment setup
- Add scripts/supabase-with-env.sh wrapper for Supabase CLI
- Add documentation for Docker Compose environment setup
- Update README.md with new usage instructions
- Replace hardcoded URLs with dynamic environment variables
This commit is contained in:
salirezav
2025-12-18 19:57:27 -05:00
parent 8cb45cbe03
commit 8f4225a62e
10 changed files with 603 additions and 17 deletions

View File

@@ -12,18 +12,21 @@ A unified monorepo combining the camera API service and the web dashboard for US
### Production Mode (Docker Compose)
1) Copy env template and set values (for web/Supabase):
**Recommended**: Use the `docker-compose.sh` wrapper script which automatically detects your host IP and sets all environment variables:
```bash
cp .env.example .env
# set VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY in .env
./docker-compose.sh up --build -d
```
2) Start the stack:
The wrapper script automatically:
- Detects your host machine's IP address
- Sets all required environment variables (VITE_*, HOST_SITE_URL, etc.)
- Generates/updates the `.env` file
- Runs docker-compose with your arguments
```bash
docker compose up --build
```
**Alternative**: If you prefer to use `docker compose` directly, the `.env` file will be auto-generated on first run, or you can set environment variables manually.
For more details, see [Docker Compose Environment Setup](docs/DOCKER_COMPOSE_ENV_SETUP.md).
- Web: <http://localhost:5173>
- API: <http://localhost:8000>