Tweak to dev/prod switch

This commit is contained in:
James Pattinson
2025-11-11 17:17:18 +00:00
parent d42b7cb307
commit be2426c078
3 changed files with 43 additions and 59 deletions

View File

@@ -90,56 +90,41 @@ membership/
## Frontend Development vs Production
The frontend supports both development and production modes using Docker Compose profiles:
Choose your deployment mode by using the appropriate docker-compose file:
### Development Mode (Vite)
```bash
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
```
- Frontend served by Vite dev server on port 3500
- Hot reloading and development features
- Access at: http://localhost:3500
- Start with: `docker-compose --profile dev up -d`
### Production Mode (Nginx)
- Optimized static files served by Nginx
- Access at: http://localhost:8080
- Start with: `docker-compose --profile prod up -d`
### Usage Examples
```bash
# Start all services in development mode
docker-compose --profile dev up -d
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
```
- Frontend served by Nginx on port 8050
- Optimized static files, production-ready
- Access at: http://localhost:8050
# Start all services in production mode
docker-compose --profile prod up -d
### Configuration
# Start only the frontend in development mode
docker-compose --profile dev up -d frontend
Set your preferred defaults in `.env`:
```bash
# Deployment mode (for reference only)
MODE=dev
# Start only the frontend in production mode
docker-compose --profile prod up -d frontend-prod
# Stop all services
docker-compose down
# Check which services are running
docker-compose ps
# Frontend allowed hosts (comma-separated)
VITE_ALLOWED_HOSTS=sasaprod,localhost,members.sasalliance.org
```
### Profile Details
- **`dev` profile**: Includes the `frontend` service (Vite dev server)
- **`prod` profile**: Includes the `frontend-prod` service (Nginx)
- **Default**: No frontend service runs unless you specify a profile
### For Production Deployment
When deploying to production with Caddy:
1. Start services in production mode:
```bash
docker-compose --profile prod up -d
```
2. Configure Caddy to proxy to `localhost:8080` for the frontend and `localhost:6000` for the API
### Stopping Services
```bash
# Stop all services
docker compose -f docker-compose.yml -f docker-compose.dev.yml down
docker compose -f docker-compose.yml -f docker-compose.prod.yml down
```
## Default Credentials