services:
  agent:
    image: gitea.interno.com/nucleo000/planilla-agent:latest
    build: ./agent
    restart: unless-stopped
    # volumes:
      # - /srv/planilla/agent:/app
    networks: [planilla]

  api:
    image: gitea.interno.com/nucleo000/planilla-api:latest
    build: ./api
    restart: unless-stopped
    environment:
      - DATABASE_URL=postgresql://planilla:secret@db:5432/planilla_db

    depends_on: [db]
    ports: ["3009:4000"]
    # volumes:
      # - /srv/planilla/api:/app
    networks: [planilla]

  # mcp (comentado aún, por si lo activás después)
  # mcp:
  #   image: gitea.interno.com/nucleo000/planilla-mcp:latest
  #   build: ./mcp
  #   volumes:
  #     - /srv/planilla/mcp:/app
  #   networks: [planilla]

  ui:
    image: gitea.interno.com/nucleo000/planilla-ui:latest
    build: ./ui
    restart: unless-stopped
    ports: ["3008:80"]
    # volumes:
      # - /srv/planilla/ui:/app
    networks: [planilla]

  worker:
    image: gitea.interno.com/nucleo000/planilla-worker:latest
    build: ./worker
    depends_on: [db]
    # volumes:
      # - /srv/planilla/worker:/app
    networks: [planilla]

  db:
    image: postgres:16
    environment:
      POSTGRES_DB: planilla_db
      POSTGRES_USER: planilla
      POSTGRES_PASSWORD: secret
    volumes:
      - /srv/planilla/db:/var/lib/postgresql/data
    networks: [planilla]

  pgadmin:
    image: dpage/pgadmin4
    environment:
      PGADMIN_DEFAULT_EMAIL: planilla@planilla.com
      PGADMIN_DEFAULT_PASSWORD: planilla
    ports:
      - "5050:80"
    depends_on:
      - db
    volumes:
      - /srv/planilla/pgadmin:/var/lib/pgadmin
    user: "5050:5050"  # ✅ necesario para evitar error de permisos
    networks: [planilla]

volumes:
  db_data:

networks:
  planilla:
