services:
  all-in-one:
    build:
      context: ./../../
      dockerfile: Dockerfile.all-in-one
    container_name: all-in-one
    ports:
      - "8123:80"
    environment:
      - VITE_FRONTEND_URL=${VITE_FRONTEND_URL}
      - VITE_API_URL_CLIENT=${VITE_API_URL_CLIENT}
      - VITE_API_URL_SERVER=${VITE_API_URL_SERVER}
      - VITE_STRIPE_PUBLISHABLE_KEY=${VITE_STRIPE_PUBLISHABLE_KEY}
      - LOG_CHANNEL=${LOG_CHANNEL}
      - QUEUE_CONNECTION=${QUEUE_CONNECTION}
      - MAIL_MAILER=${MAIL_MAILER}
      - APP_KEY=${APP_KEY}
      - APP_FRONTEND_URL=${APP_FRONTEND_URL}
      - JWT_SECRET=${JWT_SECRET}
      - FILESYSTEM_PUBLIC_DISK=${FILESYSTEM_PUBLIC_DISK}
      - FILESYSTEM_PRIVATE_DISK=${FILESYSTEM_PRIVATE_DISK}
      - APP_CDN_URL=${APP_CDN_URL}
      - DATABASE_URL=postgresql://postgres:secret@postgres:5432/hi-events

    depends_on:
      postgres:
        condition: service_healthy

  postgres:
    image: postgres:latest
    container_name: postgres
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U postgres" ]
      interval: 10s
      timeout: 5s
      retries: 5
    environment:
      POSTGRES_DB: hi-events
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: secret
    volumes:
      - pgdata:/var/lib/postgresql/data

volumes:
  pgdata:
