version: '3.7'
services:

  wildfly:
    image: jboss/wildfly:18.0.1.Final
    environment:
      JAVA_OPTS: -Delasticsearch.uri=elasticsearch:9200 -Djboss.http.port=8080 -Djava.net.preferIPv4Stack=true
    volumes:
      - ./build/distributions/example-app.war:/opt/jboss/wildfly/standalone/deployments/example-app.war
    ports:
      - "8080"
    healthcheck:
      start_period: 5s
      test: ["CMD", "grep", "Admin console listening on", "/opt/jboss/wildfly/standalone/log/server.log"]
      interval: 2s
      timeout: 1s
      retries: 5

  elasticsearch:
    image: elasticsearch-oss:test
    environment:
      discovery.type: single-node
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    healthcheck:
      start_period: 15s
      test: ["CMD", "curl", "-f", "-k", "http://localhost:9200"]
      interval: 10s
      timeout: 2s
      retries: 5