version: '3.8' services: backend: build: context: ./backend dockerfile: Dockerfile.dev ports: - "3001:3000" environment: - NODE_ENV=development - PORT=3000 - JWT_SECRET=local-dev-secret-key-123 - ADMIN_URL=http://localhost:3005 - FRONTEND_URL=http://localhost:3005 # Email - uses Mailhog - SMTP_HOST=mailhog - SMTP_PORT=1025 - SMTP_SECURE=false - SMTP_USER= - SMTP_PASS= - EMAIL_FROM=noreply@photo-sharing.local # Storage path - STORAGE_PATH=/app/storage # Umami Analytics (optional) - UMAMI_URL= - UMAMI_WEBSITE_ID= volumes: - ./backend:/app - /app/node_modules - ./storage:/app/storage - ./data:/app/data - ./logs:/app/logs depends_on: - mailhog command: sh -c "npm install && npm run migrate && npm run dev" healthcheck: test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/api/health"] interval: 30s timeout: 10s retries: 3 frontend: build: context: ./frontend dockerfile: Dockerfile.dev args: - VITE_API_URL=http://localhost:3001 - VITE_UMAMI_URL= - VITE_UMAMI_WEBSITE_ID= ports: - "3005:80" environment: - NODE_ENV=development volumes: - ./frontend/dist:/usr/share/nginx/html - ./frontend/nginx.dev.conf:/etc/nginx/conf.d/default.conf:ro depends_on: - backend healthcheck: test: ["CMD", "curl", "-f", "http://localhost/health"] interval: 30s timeout: 10s retries: 3 # Development frontend with hot reload frontend-dev: image: node:18-alpine working_dir: /app ports: - "3002:5173" environment: - NODE_ENV=development - VITE_API_URL=http://localhost:3001 - VITE_UMAMI_URL= - VITE_UMAMI_WEBSITE_ID= volumes: - ./frontend:/app - /app/node_modules command: sh -c "npm install --legacy-peer-deps && npm run dev -- --host" depends_on: - backend mailhog: image: mailhog/mailhog:latest ports: - "1025:1025" # SMTP - "8025:8025" # Web UI # Optional: File watcher service file-watcher: build: context: ./backend dockerfile: Dockerfile.dev environment: - NODE_ENV=development - STORAGE_PATH=/app/storage volumes: - ./backend:/app - /app/node_modules - ./storage:/app/storage - ./data:/app/data command: node src/services/fileWatcher.js depends_on: - backend volumes: node_modules_backend: node_modules_frontend: