Ctrl K
ComunidadGuías…

docker-compose.yml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
name: libratory

services:
  postgres:
    image: pgvector/pgvector:pg17
    ports:
      # Loopback like the app's own port: the password is `libratory` and there is no other gate,
      # so a host with a public interface would otherwise publish the whole library.
      - "127.0.0.1:5433:5432"
    environment:
      POSTGRES_USER: libratory
      POSTGRES_PASSWORD: libratory
      POSTGRES_DB: libratory
    volumes:
      # pgdata17 (glibc) replaced the alpine-era pgdata volume on 2026-08-08; old volume kept as rollback
      - pgdata17:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U libratory"]
      interval: 5s
      timeout: 5s
      retries: 12

  app:
    # Behind a profile so `pnpm db:up` keeps meaning "Postgres and nothing else" on a Mac.
    # The headless path opts in:  docker compose --profile app up -d --build
    profiles: ["app"]
    # Published by .github/workflows/docker.yml on every release, for amd64 and arm64. With both
    # `image` and `build` here, `up -d --build` still builds from this checkout, and
    # `pull` followed by `up -d` runs the prebuilt one — the README shows both.
    image: ghcr.io/subev/libratory:latest
    build: .
    ports:
      # Published on localhost for the same reason HOST defaults to 127.0.0.1 — there is no login.
      # To serve the LAN, override with `ports: !override ["3034:3034"]` in a
      # docker-compose.override.yml — plain entries are appended, not replaced, and the second
      # binding fails on the port this one already holds — and mind who is on that network.
      - "127.0.0.1:3034:3034"
    environment:
      DATABASE_URL: postgres://libratory:libratory@postgres:5432/libratory
      # Ollama and LM Studio run on the host, which a container reaches by this name; host-gateway
      # makes the name resolve on Linux too, where Docker does not define it.
      OLLAMA_URL: http://host.docker.internal:11434
      LMSTUDIO_URL: http://host.docker.internal:1234
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      # Named volumes rather than ./data — a bind mount the daemon creates on first `up` arrives
      # owned by root, and the server (running as node) cannot write into it. To keep the library
      # in a directory instead, mkdir it yourself and override the mount.
      - data:/data
      - models:/models
    depends_on:
      # main.ts applies pending migrations at boot, so a plain depends_on races the first `up` and
      # leaves restart: unless-stopped to paper over it. test.yml gates on health for this reason.
      postgres:
        condition: service_healthy
    restart: unless-stopped

volumes:
  pgdata17:
  data:
  models: