version: '3.3'
networks:
  modularnetwork:
    name: modularnetwork
    driver: bridge

services:
  modularDb:
    container_name: "ModularDbApi"
    image: mariadb
    restart: always
    volumes:
      - modulardata:/var/lib/mysql
    networks:
      - modularnetwork
    ports:
      - '3312:3306'
    deploy:
      resources:
        limits:
          memory: 2G
        reservations:
          memory: 1G
    environment:
      MYSQL_ROOT_PASSWORD: kichasher
      MYSQL_DATABASE: modular_api
      MYSQL_USER: root
      MYSQL_PASSWORD: kichasher

  modularapi:
    container_name: modularapi
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ~/.composer-docker/cache:/root/.composer/cache:delegated
      - ./:/app:delegated
      - /app/vendor
      - ./config/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
    networks:
      - modularnetwork
    ports:
      - '8104:80'
    deploy:
      resources:
        limits:
          memory: 2G
        reservations:
          memory: 1G
    #command: bash -c "vendor/bin/yii migrate --appconfig=migrationConfig.php --interactive=0"
    depends_on:
      - modularDb
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - '8892:80'
    environment:
      - PMA_ARBITRARY=1
      - PMA_HOST=modularDb
      - UPLOAD_LIMIT=300M
    depends_on:
      - modularDb
    networks:
      - modularnetwork
volumes:
  modulardata: {}
