networks:
  nocobase:
    driver: bridge

services:
  app:
    image: nocobase/nocobase:latest-full
    restart: always
    networks:
      - nocobase
    depends_on:
      - postgres
    environment:
      # Application key, used to generate user tokens, etc.
      # If APP_KEY is changed, old tokens will become invalid
      # Can be any random string, and ensure it is not leaked
      - APP_KEY=KHDEwGN2PMpE5lL/eRpODDy1QpHZuFd9L1WLMnIh82A=
      # Database type, supports postgres, mysql, mariadb
      - DB_DIALECT=postgres
      # Database host, can be replaced with an existing database server IP
      - DB_HOST=postgres
      # Database port
      - DB_PORT=5432
      # Database name
      - DB_DATABASE=nocobase
      # Database user
      - DB_USER=nocobase
      # Database password
      - DB_PASSWORD=nocobase
      # Timezone, please change it to your local timezone, e.g., America/New_York
      - TZ=Asia/Hong_Kong
      # Ollama endpoint
      - OLLAMA_URL=http://172.17.0.1:11434

    volumes:
      - ./storage:/app/nocobase/storage
    ports:
      - '8082:80'
    # init: true

  # If you use an existing database service, you can skip starting postgres
  postgres:
    image: postgres:16
    restart: always
    command: postgres -c wal_level=logical
    environment:
      POSTGRES_USER: nocobase
      POSTGRES_DB: nocobase
      POSTGRES_PASSWORD: nocobase
    volumes:
      - ./storage/db/postgres:/var/lib/postgresql/data
    networks:
      - nocobase
