← back to Govarbitrage

docker-compose.yml

58 lines

# GovArbitrage — local/dev stack.
#
# First run: bring up the db, then push the schema + seed it, e.g.:
#   docker compose up -d db
#   docker compose run --rm web npx prisma db push
#   docker compose run --rm web npm run db:seed
# (i.e. run `npx prisma db push && npm run db:seed` against the db service),
# then `docker compose up web`.

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

  # Optional — only needed if you enable BullMQ background jobs (REDIS_URL set).
  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    volumes:
      - redis-data:/data

  web:
    build:
      context: .
      dockerfile: Dockerfile
    depends_on:
      db:
        condition: service_healthy
    environment:
      DATABASE_URL: "postgresql://govarbitrage:govarbitrage@db:5432/govarbitrage?schema=public"
      REDIS_URL: "redis://redis:6379"
      NODE_ENV: "production"
      # Local AI (Ollama) runs on the host; from inside the container reach it via
      # host.docker.internal. Leave AI opt-out to fall back to the heuristic.
      OLLAMA_BASE_URL: "http://host.docker.internal:11434"
      AI_PROVIDER: "ollama"
      AUTH_SECRET: "dev-only-change-me"
      ENCRYPTION_KEY: "0123456789abcdef0123456789abcdef"
    ports:
      - "3000:3000"

volumes:
  db-data:
  redis-data: