
services:
  nginx:
    image: nginx:latest
    volumes:
      - ./:/var/www
      - ./_docker/nginx/conf.d:/etc/nginx/conf.d
    ports:
      - "8876:80"
    container_name: crm-s_nginx
    
  app:
    build:
      context: .
      dockerfile: _docker/app/Dockerfile
    volumes:
      - ./:/var/www/
    depends_on:
      - nginx
      - db
    container_name: crm-s_app

  db:
    image: mysql:8.0
    restart: always
    volumes:
      - ./tmp/db:/var/lib/mysql
      - ./_docker/mysql/my.cnf:/etc/mysql/my.cnf
    environment:
        MYSQL_DATABASE: crm-s
        MYSQL_ROOT_PASSWORD: root
        MYSQL_USER: admin
        MYSQL_PASSWORD: admin
    ports:
      - "8101:3306"
    command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
    container_name: crm-s_db

  phpmyadmin:
    image: phpmyadmin
    restart: unless-stopped
    depends_on:
      - db
    ports:
      - 8877:80
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: admin
      MYSQL_PASSWORD: admin
    container_name: crm-s_phpmyadmin