version: '3.1'

services:

  wp:
    image: wordpress:6.5-apache
    restart: unless-stopped
    env_file: /data/collectif-arthadie.fr/env
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: wpdbuser
      WORDPRESS_DB_NAME: wpdb
    volumes:
      - /data/collectif-arthadie.fr/wordpress:/var/www/html
      - /data/collectif-arthadie.fr/static:/var/www/html/static
    networks:
      default:
        ipv4_address: $NET.100
    deploy:
      resources:
        limits:
          cpus: '1'
          memory: 500M

  db:
    image: mariadb:10.4
    restart: unless-stopped
    env_file: /data/collectif-arthadie.fr/env
    environment:
      MYSQL_DATABASE: wpdb
      MYSQL_USER: wpdbuser
      MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
    volumes:
      - /data/collectif-arthadie.fr/db:/var/lib/mysql
    networks:
      default:
        ipv4_address: $NET.101
    deploy:
      resources:
        limits:
          cpus: '0.50'
          memory: 300M

networks:
  default:
    ipam:
      config:
        - subnet: $NET.0/24