version: '3.3'

services:
  nginx:
    image: nginx:1.21.0-alpine
    container_name: ${COMPOSE_PROJECT_NAME}_dev_nginx
    ports:
      - ${NGINX_EXPOSED_PORT}:80
    volumes:
      - ${PROJECT_TVP}:/var/www/html
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - php
      # - mysql
    networks:
      - tvp
  mysql:
    image: mysql:5.6
    container_name: ${COMPOSE_PROJECT_NAME}_dev_mysql
    restart: always
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
    ports:
      - ${DB_PORT}:3306
    volumes:
      - ./../dataBase/mysql:/var/lib/mysql
    networks:
      - tvp
  php:
    build:
      args:
        user: phpuser
        uid: 1000
      context: .
      dockerfile: php.Dockerfile
    container_name: ${COMPOSE_PROJECT_NAME}_dev_php
    volumes:
      - ${PROJECT_TVP}:/var/www/html
    ports:
      - 9000:80
    networks:
      - tvp
  laravel-websocket:
    build:
      args:
        user: phpuser
        uid: 1000
      context: .
      dockerfile: php.Dockerfile
    container_name: ${COMPOSE_PROJECT_NAME}_dev_laravel-websocket
    command: php artisan websocket:serve --port=6003
    volumes:
      - ${PROJECT_TVP}:/var/www/html
    networks:
      - tvp
    ports:
      - 6003:6003

networks:
  tvp:
