services:
  db:
    image: postgres:17-alpine
    environment:
      POSTGRES_DB: wedding
      POSTGRES_USER: wedding
      POSTGRES_PASSWORD: wedding
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U wedding"]
      interval: 5s
      timeout: 5s
      retries: 5

  backend:
    build: ./backend
    environment:
      DATABASE_URL: postgres://wedding:wedding@db:5432/wedding
      PORT: 8080
    depends_on:
      db:
        condition: service_healthy

  frontend:
    build: ./frontend
    ports:
      - "3000:80"
    depends_on:
      - backend

volumes:
  postgres_data:
