services:
  postgres:
    image: postgres:17
    environment:
      POSTGRES_DB: fedeo_push
      POSTGRES_USER: fedeo_push
      POSTGRES_PASSWORD: fedeo_push
    ports:
      - "5442:5432"
    volumes:
      - push_postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U fedeo_push -d fedeo_push"]
      interval: 10s
      timeout: 5s
      retries: 5

  api:
    build:
      context: .
      dockerfile: apps/api/Dockerfile
    env_file: .env
    environment:
      DATABASE_URL: postgres://fedeo_push:fedeo_push@postgres:5432/fedeo_push
    ports:
      - "4020:4020"
    depends_on:
      postgres:
        condition: service_healthy

  admin:
    build:
      context: .
      dockerfile: apps/admin/Dockerfile
    env_file: .env
    environment:
      NUXT_PUBLIC_API_BASE: http://localhost:4020
    ports:
      - "3020:3000"
    depends_on:
      - api

volumes:
  push_postgres_data:
