services:
  nginx:
    container_name: opengnsys-nginx
    build:
      context: ./docker
      dockerfile: Dockerfile-nginx
    depends_on:
      - php
    ports:
      - 9080:80
    volumes:
      - ./public:/var/www/html/public:cached
    networks:
      - opengnsys-network

  php:
    container_name: opengnsys-php
    build:
      context: ./docker
      dockerfile: Dockerfile-php
    volumes:
      - ./:/var/www/html
    environment:
      XDEBUG_CLIENT_HOST: 127.17.0.1
      XDEBUG_CLIENT_PORT: 9003
      PHP_IDE_CONFIG: serverName=ogcore
    networks:
      - opengnsys-network
        
  python:
    build:
      context: ./docker
      dockerfile: Dockerfile-python
    container_name: opengnsys-python
    environment:
      OPENGNSYS: "/opt/opengnsys"
      OGCORE: "/opt/ogcore"
    volumes:
      - ./client/shared:/opt/opengnsys/
      - ./client/engine:/opt/opengnsys/client/lib/engine
    networks:
      - opengnsys-network
    #entrypoint: /bin/sh -c "python3 /opt/opengnsys/etc/preinit/default.py && tail -f /dev/null"
    entrypoint: /bin/sh -c "bash /opt/opengnsys/etc/preinit/default.sh && tail -f /dev/null"

  show_message:
    image: busybox
    container_name: final_message
    depends_on:
      - nginx
    command: sh -c 'echo -e "\tAccess NGINX at http://localhost:7500\n\tPlace Clonning-Engine test files for /opt/opengnsys/etc in ./client"' 
    networks:
      - opengnsys-network
    deploy:
      restart_policy:
        condition: "no"

volumes:
  database_data:

networks:
  opengnsys-network:
