services:
  pocketbase:
    build:
      context: .
      target: dev
    container_name: pocketbase
    restart: on-failure:3
    ports:
      - 8090:8090
    volumes:
      - ./pb_data:/pb/pb_data
      - ./pb_migrations:/pb/pb_migrations
      - ./pb_hooks:/pb/pb_hooks
    env_file:
      - ../.env
    environment:
      SIDECAR_URL: http://sidecar:8091

  sidecar:
    image: denoland/deno:latest
    working_dir: /app
    command: deno task dev
    container_name: sidecar
    restart: on-failure:3
    ports:
      - 8091:8091
    volumes:
      - ./sidecar:/app
    env_file:
      - ../.env
    environment:
      POCKETBASE_URL: http://pocketbase:8090
    depends_on:
      - pocketbase

  mailpit:
    image: axllent/mailpit
    container_name: mailpit
    restart: on-failure:3
    ports:
      - 8025:8025
    volumes:
      - ./mp_data:/data
    environment:
      MP_MAX_MESSAGES: 5000
      MP_DATABASE: /data/mailpit.db
      MP_SMTP_AUTH_ACCEPT_ANY: 1
      MP_SMTP_AUTH_ALLOW_INSECURE: 1

volumes:
  pocketbase_data:
  mailpit-data:
