version: '3.5'

networks:
  my_network:
    name: "my_network"
services:
  nginx:
    container_name: "nginx"
    build:
      context: "../../docker/nginx"
      target: "local"
    image: "jinomon/nginx"
    ports: 
      - "8081:80"
    volumes:
      - "../../src:/var/www:cached"
    depends_on:
      - "php-fpm"
    networks:
      - my_network

  php-fpm:
    container_name: "php-fpm"
    build:
      context: "../../docker/php-fpm"
      target: "local"
    image: "jinomon/php-fpm-jinomon"
    volumes:
      - "../../src:/var/www:cached"
    environment:
      TZ: "Asia/Tokyo"
    networks:
      - my_network

  mysql:
    container_name: "mysql_jnomon"
    image: "mysql:8.0"
    volumes:
      - "db_data:/var/lib/mysql_jinomon"
    environment:
     MYSQL_ROOT_PASSWORD: "mysql"
     MYSQL_USER: "default"
     MYSQL_PASSWORD: "secret"
     MYSQL_DATABASE: "db_jinomon"
     TZ: "Asia/Tokyo"
    ports:
      - "3307:3306"
    networks:
      - my_network

  phpmyadmin:
    image: "phpmyadmin/phpmyadmin"
    container_name: "phpmyadmin"
    environment:
      - PMA_ARBITRARY=1
      - PMA_HOST=mysql
      - PMA_USER=root
      - PMA_PORT=3306
      - PMA_PASSWORD=mysql
      - UPLOAD_LIMIT=50M  
    links:
      - mysql
    ports:
      - 8080:80
    volumes:
      - /sessions
    networks:
      - my_network

  mailpit:
    container_name: "mailpit"
    image: "axllent/mailpit:latest"
    ports:
      - "1025:1025"
      - "8025:8025"
    networks:
      - my_network

volumes:
  db_data:
  redis_volume:
    driver: "local"
