{% include 'roles/docker-compose/templates/base.yml.j2' %}
  nginx:
{% set container_port = 8000 %}
    image: "{{ MAGENTO_NGINX_IMAGE }}:{{ MAGENTO_NGINX_VERSION }}"
    container_name: "{{ MAGENTO_NGINX_CONTAINER }}"
    environment:
      PHP_HOST: "php"
      PHP_PORT: "9000"
    depends_on:
      - php
      - search
    volumes:
      - "data:/var/www/html"
    ports:
      - "127.0.0.1:{{ ports.localhost.http[application_id] }}:{{ container_port }}"
    healthcheck:
      test: ["CMD-SHELL", "nginx -t >/dev/null 2>&1 && { grep -q ':1F40' /proc/net/tcp || grep -q ':1F40' /proc/net/tcp6; }"]
      interval: 10s
      timeout: 5s
      retries: 5
{% include 'roles/docker-container/templates/networks.yml.j2' %}

  php:
{% include 'roles/docker-container/templates/base.yml.j2' %}
    image: "{{ MAGENTO_PHP_IMAGE }}:{{ MAGENTO_PHP_VERSION }}"
    container_name: "{{ MAGENTO_PHP_CONTAINER }}"
    volumes:
      - "data:/var/www/html"
{% include 'roles/docker-container/templates/depends_on/dmbs_incl.yml.j2' %}
      search:
        condition: service_started
{% include 'roles/docker-container/templates/networks.yml.j2' %}

  search:
{% set container_port = 9200 %}
    image: "{{ MAGENTO_SEARCH_IMAGE }}:{{ MAGENTO_SEARCH_VERSION }}"
    container_name: "{{ MAGENTO_SEARCH_CONTAINER }}"
{% include 'roles/docker-container/templates/base.yml.j2' %}
    environment:
      - discovery.type=single-node
      - plugins.security.disabled=true
      - OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m
{% include 'roles/docker-container/templates/healthcheck/tcp.yml.j2' %}
{% include 'roles/docker-container/templates/networks.yml.j2' %}

{% include 'roles/docker-compose/templates/volumes.yml.j2' %}
  data:
    name: {{ MAGENTO_VOLUME }}

{% include 'roles/docker-compose/templates/networks.yml.j2' %}

