# Docker Guide ## Docker Compose ```bash # Start services docker-compose up -d # Setup database docker-compose exec app bun run db:push # View logs docker-compose logs -f app # Stop services docker-compose down ``` Visit `http://localhost:3000` ## Docker Build ```bash # Build image docker build -t wishlist-app . # Run container docker run -d \ -p 3000:3000 \ -e DATABASE_URL="postgresql://user:pass@host:5432/db" \ --name wishlist-app \ wishlist-app ``` ## Environment Variables Required: - `DATABASE_URL` - PostgreSQL connection string - `NODE_ENV` - Set to `production` - `PORT` - Default `3000` Optional (Docker Compose): - `POSTGRES_USER` - Database user (default: `wishlistuser`) - `POSTGRES_PASSWORD` - Database password (default: `wishlistpassword`) - `POSTGRES_DB` - Database name (default: `wishlist`) - `POSTGRES_DATA_PATH` - Custom path for PostgreSQL data - Example: `/mnt/storage/wishlist/postgres` - Must be an absolute path - Directory must exist with proper permissions ## Database Setup ```bash # docker-compose docker-compose exec app bun run db:push # Standalone container docker exec -it wishlist-app bun run db:push ``` ## Migrations Production migrations: ```bash docker exec -it wishlist-app bun run db:migrate ```