services:
  app:
    build:
      context: .
      dockerfile: docker/Dockerfile
    image: laravel-erp-app
    restart: unless-stopped
    working_dir: /var/www/html
    volumes:
      - .:/var/www/html
      - ./docker/php.ini:/usr/local/etc/php/conf.d/local.ini
    user: "1000:1000"
    networks:
      - erp-network

  web:
    image: nginx:alpine
    restart: unless-stopped
    ports:
      - "8000:80"
    volumes:
      - .:/var/www/html
      - ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - app
    networks:
      - erp-network

  db:
    image: mysql:8.4
    restart: unless-stopped
    ports:
      - "33066:3306"
    environment:
      MYSQL_DATABASE: erp_db
      MYSQL_USER: erp_user
      MYSQL_PASSWORD: erp_password
      MYSQL_ROOT_PASSWORD: root_password
    volumes:
      - erp-db-data:/var/lib/mysql
    networks:
      - erp-network

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

networks:
  erp-network:
    driver: bridge

volumes:
  erp-db-data:
    driver: local
  erp-redis-data:
    driver: local
