services:
  chirpstack:
    image: chirpstack/chirpstack-dev-cache:latest
    platform: linux/amd64
    volumes:
      - ./:/chirpstack
    depends_on:
      - postgres
      - redis
      - mosquitto
    environment:
      - DATABASE_URL=postgres://chirpstack_test:chirpstack_test@postgres/chirpstack_test?sslmode=disable
      - REDIS_HOST=redis
      - POSTGRESQL_HOST=postgres
      - MQTT_BROKER_HOST=mosquitto
    ports:
      - "8080:8080"

  chirpstack-build-amd64:
    image: chirpstack/chirpstack-dev-cache:latest
    platform: linux/amd64
    volumes:
      - ./:/chirpstack

  chirpstack-build-arm64:
    image: chirpstack/chirpstack-dev-cache:latest
    platform: linux/arm64
    volumes:
      - ./:/chirpstack

  chirpstack-ui:
    build:
      context: ./ui
      dockerfile: Dockerfile-devel
    volumes:
      - ./api/grpc-web:/chirpstack/api/grpc-web
      - ./ui:/chirpstack/ui
    ports:
      - "3000:3000"

  postgres:
    image: postgres:11-alpine
    volumes:
      - ./.docker-compose/postgresql/initdb:/docker-entrypoint-initdb.d
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust

  redis:
    image: redis:6-alpine

  mosquitto:
    image: eclipse-mosquitto:1.6
    ports:
      - "1883:1883"
