File size: 1,000 Bytes
570f7bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
version: "3.9"

services:
  postgres:
    image: postgres:16
    container_name: nl2sql_pg
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: demo
    volumes:
      - pgdata:/var/lib/postgresql/data
      - ./infra/migrate.sql:/docker-entrypoint-initdb.d/00_init.sql:ro
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d demo"]
      interval: 5s
      timeout: 3s
      retries: 10

  api:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: nl2sql_api
    depends_on:
      postgres:
        condition: service_healthy
    environment:
      DB_MODE: postgres
      POSTGRES_DSN: dbname=demo user=postgres password=postgres host=postgres port=5432
      OPENAI_MODEL_ID: gpt-4o-mini
      OPENAI_API_KEY: ${OPENAI_API_KEY}
    ports:
      - "8000:8000"
    command: ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers"]

volumes:
  pgdata: