# ───────────────────────────────────────────────────────────── # CompanyBrain — one-command self-host # # cp .env.example .env # (optional — defaults work) # docker compose up -d # open http://localhost:3000 # # Brings up: Postgres+pgvector, the API, the web dashboard. # ───────────────────────────────────────────────────────────── name: companybrain services: db: image: pgvector/pgvector:pg16 restart: unless-stopped environment: POSTGRES_USER: ${POSTGRES_USER:-companybrain} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-companybrain} POSTGRES_DB: ${POSTGRES_DB:-companybrain} ports: - "${POSTGRES_PORT:-5432}:5432" volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-companybrain} -d ${POSTGRES_DB:-companybrain}"] interval: 5s timeout: 5s retries: 20 api: build: context: . dockerfile: apps/api/Dockerfile restart: unless-stopped depends_on: db: condition: service_healthy # Everything in .env reaches the API, not only the names listed below, so # AUTH_MODE, ACCESS_TOKEN, CREDENTIALS_KEY, the model names, and the rest of # .env.example take effect. The file is optional: with none, the defaults # run. Entries under `environment` win over the file. env_file: - path: .env required: false environment: NODE_ENV: production DATABASE_URL: postgres://${POSTGRES_USER:-companybrain}:${POSTGRES_PASSWORD:-companybrain}@db:5432/${POSTGRES_DB:-companybrain} JWT_SECRET: ${JWT_SECRET:-dev-only-change-me-please-0000000000000000000000000000000000000000} API_HOST: 0.0.0.0 API_PORT: 3333 CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:3000} EMBEDDING_PROVIDER: ${EMBEDDING_PROVIDER:-local} LLM_PROVIDER: ${LLM_PROVIDER:-none} OPENAI_API_KEY: ${OPENAI_API_KEY:-} ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-} # Inside the container, localhost is the container. An Ollama server on # the host machine is reached through host.docker.internal instead. OLLAMA_BASE_URL: ${OLLAMA_BASE_URL:-http://host.docker.internal:11434} extra_hosts: # Docker Desktop defines this name already; Linux needs it spelled out. - "host.docker.internal:host-gateway" ports: - "${API_PORT:-3333}:3333" web: build: context: . dockerfile: apps/web/Dockerfile restart: unless-stopped depends_on: - api environment: NODE_ENV: production NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:3333} ports: - "${WEB_PORT:-3000}:3000" volumes: pgdata: