name: bemeal
services:
  pgsql:
    image: postgres:15-alpine
    container_name: bemeal-pgsql
    restart: unless-stopped
    environment:
      POSTGRES_DB: "${DB_DATABASE:?DB_DATABASE is required}"
      POSTGRES_USER: "${DB_USERNAME:?DB_USERNAME is required}"
      POSTGRES_PASSWORD: "${DB_PASSWORD:?DB_PASSWORD is required}"
    volumes:
      - pgsql-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -p 5432"]
      start_period: 30s
      interval: 5s
      timeout: 5s
      retries: 10
    networks:
      - internal

  redis:
    image: redis:alpine
    container_name: bemeal-redis
    restart: unless-stopped
    volumes:
      - redis-data:/data
    networks:
      - internal

  adminer:
    image: adminer:latest
    container_name: bemeal-adminer
    restart: unless-stopped
    environment:
      ADMINER_DEFAULT_SERVER: bemeal-pgsql
    networks:
      - internal

  meilisearch:
    image: getmeili/meilisearch:latest
    container_name: bemeal-meilisearch
    restart: unless-stopped
    environment:
      MEILI_NO_ANALYTICS: "true"
      MEILI_MASTER_KEY: "${MEILISEARCH_KEY:?MEILISEARCH_KEY is required}"
    volumes:
      - meilisearch-data:/meili_data
    networks:
      - internal

volumes:
  pgsql-data:
    external: true
    name: bemeal_pgsql_data

  redis-data:
    name: bemeal_redis_data

  meilisearch-data:
    name: bemeal_meilisearch_data

networks:
  internal:
    external: true
    name: bemeal_internal
