version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: docker/Dockerfile
    container_name: n2sys-app
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/html
      - ./docker/php.ini:/usr/local/etc/php/php.ini
    environment:
      - APP_ENV=development
    depends_on:
      - db
    networks:
      - n2sys-network

  db:
    image: mysql:8.0
    container_name: n2sys-db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: n2sys
      MYSQL_USER: n2sys_user
      MYSQL_PASSWORD: n2sys_password
      MYSQL_ROOT_PASSWORD: root_password
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql
      - ./docker/mysql/init:/docker-entrypoint-initdb.d
    networks:
      - n2sys-network

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    container_name: n2sys-phpmyadmin
    restart: unless-stopped
    ports:
      - "8081:80"
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_USER: n2sys_user
      PMA_PASSWORD: n2sys_password
    depends_on:
      - db
    networks:
      - n2sys-network

  redis:
    image: redis:7-alpine
    container_name: n2sys-redis
    restart: unless-stopped
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    networks:
      - n2sys-network

volumes:
  mysql_data:
  redis_data:

networks:
  n2sys-network:
    driver: bridge
