services:
  database:
    container_name: ogcore-database
    image: mariadb:10.11
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: ogcore
      MYSQL_PASSWORD: root
      MYSQL_USER: admin
    ports:
      - 3336:3306
    volumes:
      - database_data:/var/lib/mysql
    networks:
      - ogcore-network
  nginx:
    container_name: ogcore-nginx
    depends_on:
      - php
    ports:
      - 8080:80
      - 8443:443
      - 3000:3000 
    volumes:
      - ogpublic:/var/www/html/public:cached
    networks:
      - ogcore-network
    image: opengnsys/ogcore-nginx:static

  php:
    container_name: ogcore-php
    depends_on:
      - database
    volumes:
      - ogpublic:/var/www/html/public
      - /opt/opengnsys/ogCore/etc/.env:/var/www/html/.env
      - /opt/opengnsys/ogCore/etc/env.json://var/www/html/env.json

    networks:
      - ogcore-network
    image: opengnsys/ogcore-php:static

  mercure:
    image: dunglas/mercure
    restart: unless-stopped
    container_name: ogcore-mercure
    environment:
      # Uncomment the following line to disable HTTPS,
      SERVER_NAME: ':3000'
      MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
      MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
      MERCURE_EXTRA_DIRECTIVES: |
        cors_origins *
    # Comment the following line to disable the development mode
    command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile
    # ports:
    #   - "3000:3000"
    volumes:
      - mercure_data:/data
      - mercure_config:/config
    networks:
      - ogcore-network

volumes:
  database_data:
  ogpublic:
  mercure_data:
  mercure_config:


networks:
  ogcore-network:
