File size: 2,067 Bytes
2293b35
 
 
 
af86e9a
 
 
 
2293b35
af86e9a
2293b35
af86e9a
 
 
 
 
 
 
 
2293b35
 
af86e9a
2293b35
 
af86e9a
2293b35
af86e9a
 
 
 
2293b35
af86e9a
 
 
 
 
 
2293b35
af86e9a
 
2293b35
 
af86e9a
 
 
 
 
 
2293b35
 
af86e9a
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# ═══════════════════════════════════════════════════════════════
# docker-compose.yml — Desenvolvimento local
# Para HuggingFace Spaces: usar apenas o Dockerfile (single container)
# ═══════════════════════════════════════════════════════════════
version: "3.9"

services:

  # ── Elasticsearch ──────────────────────────────────────────────
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.12.2
    container_name: es_juridico
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=false
      - xpack.security.enrollment.enabled=false
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
    ports:
      - "9200:9200"
    volumes:
      - esdata:/usr/share/elasticsearch/data
    healthcheck:
      test: ["CMD-SHELL", "curl -sf http://0.0.0.09200/_cluster/health | python3 -c \"import sys,json; s=json.load(sys.stdin)['status']; sys.exit(0 if s in ['green','yellow'] else 1)\""]
      interval: 10s
      timeout: 10s
      retries: 15
      start_period: 60s
    networks:
      - juridico_net

  # ── FastAPI (multi-container — dev local) ─────────────────────
  api:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: api_juridico
    environment:
      - ES_HOST=http://elasticsearch:9200   # usa o serviço do compose
      - ES_INDEX=assuntos_juridicos
      - PORT=7860
      - APP_ENV=development
      - WORKERS=1
    ports:
      - "7860:7860"
    depends_on:
      elasticsearch:
        condition: service_healthy
    volumes:
      - ./app:/app/app
      - ./data:/app/data
    networks:
      - juridico_net
    restart: unless-stopped

volumes:
  esdata:

networks:
  juridico_net: