services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "8080:8080"
    environment:
      CAIRNQUIRE_SERVER_ADDR: ":8080"
      CAIRNQUIRE_DATABASE_PATH: "/workspace/data/db.sqlite"
      CAIRNQUIRE_CONTENT_SOURCE_DIR: "/workspace/content"
      CAIRNQUIRE_CONTENT_STORE_DIR: "/workspace/data/files"
      CAIRNQUIRE_PUBLIC_ORIGIN: "${CAIRNQUIRE_PUBLIC_ORIGIN:?Set CAIRNQUIRE_PUBLIC_ORIGIN in .env}"
      CAIRNQUIRE_EMAIL_SMTP_HOST: "${CAIRNQUIRE_EMAIL_SMTP_HOST:-mailpit}"
      CAIRNQUIRE_EMAIL_SMTP_PORT: "${CAIRNQUIRE_EMAIL_SMTP_PORT:-1025}"
      CAIRNQUIRE_EMAIL_FROM: "${CAIRNQUIRE_EMAIL_FROM:-notifications@cairnquire.local}"
      CAIRNQUIRE_LOG_LEVEL: "${CAIRNQUIRE_LOG_LEVEL:-INFO}"
    volumes:
      - ./content:/workspace/content
      - ./data:/workspace/data
    healthcheck:
      test: ["CMD", "curl", "--fail", "http://127.0.0.1:8080/health"]
      interval: 10s
      timeout: 3s
      retries: 5
      start_period: 5s

  mailpit:
    image: axllent/mailpit:latest
    ports:
      - "8025:8025"
    environment:
      MP_UI_BIND_ADDR: "0.0.0.0:8025"
      MP_SMTP_BIND_ADDR: "0.0.0.0:1025"
