version: "3"

networks:
  castopod:

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

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

  mariadb:
    image: mariadb:latest
    container_name: castopod-host_mariadb
    ports:
      - 3306:3306
    volumes:
      - mariadb:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: castopod
      MYSQL_USER: podlibre
      MYSQL_PASSWORD: castopod
    networks:
      - castopod

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

volumes:
  redis:
  mariadb:
  phpmyadmin:
