#!/usr/bin/env bash # Run the Vite dev container from WSL (Docker Desktop with WSL2 backend, or Docker Engine in WSL). # # Usage (from repo root): # chmod +x scripts/docker-up-wsl.sh # ./scripts/docker-up-wsl.sh # # Or from anywhere: # bash /mnt/d/Test/alrahma/client_laravel/scripts/docker-up-wsl.sh # # Windows D: drive in WSL is usually: /mnt/d/Test/alrahma/client_laravel # # Laravel API proxy: defaults to host port 8000. Override if requests fail: # export VITE_PROXY_API=http://172.17.0.1:8000 # ./scripts/docker-up-wsl.sh # set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" cd "$ROOT" if [[ "$(pwd)" == /mnt/* ]]; then echo "Note: Project is on a Windows mount (/mnt/...). File sync can be slower; Vite uses polling." >&2 fi export VITE_PROXY_API="${VITE_PROXY_API:-http://host.docker.internal:8000}" echo "Using VITE_PROXY_API=${VITE_PROXY_API}" >&2 echo "App → http://localhost:5173 (ensure Laravel is reachable from the container at the proxy target)" >&2 exec docker compose up --build client