version: "3"

networks:
  castopod:

services:
  app:
    build:
      context: .
      dockerfile: docker/development/Dockerfile
    container_name: app
    command: /bin/sh -c "crontab ./crontab && cron && service cron reload && php spark serve --host 0.0.0.0"
    ports:
      - 8080:8080
    volumes:
      - .:/castopod
    depends_on:
      - redis
      - mariadb
    networks:
      - castopod

  redis:
    image: redis:alpine
    container_name: castopod_redis
    ports:
      - 6379:6379
    volumes:
      - redis:/data
    networks:
      - castopod

  mariadb:
    image: mariadb:10.2
    container_name: castopod_mariadb
    ports:
      - 3306:3306
    volumes:
      - ./initdb:/docker-entrypoint-initdb.d
      - mariadb:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: castopod
      MYSQL_USER: castopod
      MYSQL_PASSWORD: castopod
    networks:
      - castopod

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    container_name: castopod_phpmyadmin
    environment:
      PMA_HOST: mariadb
      PMA_PORT: 3306
    ports:
      - 8888:80
    volumes:
      - phpmyadmin:/sessions
    depends_on:
      - mariadb
    networks:
      - castopod

volumes:
  redis:
  mariadb:
  phpmyadmin:
