version: '3.3'

services:

  nginx:
    build: requirements/nginx/
    container_name: nginx
    environment:
      - DOMAIN_NAME=apommier.42.fr
      - SSL_CERTIFICATE=/etc/ssl/certs/nginx-selfsigned.crt
      - SSL_CERTIFICATE_KEY=/etc/ssl/private/nginx-selfsigned.key 
    depends_on:
      - wordpress
    ports:
      - 443:443
      - 80:80
    volumes:
      - ./wordpress:/var/www/html
    restart: unless-stopped
    networks:
      - wpnetwork

  wordpress:
    build: ./requirements/wordpress
    volumes:
     # - wpfiles:/var/www/html
     - ./wordpress:/var/www/html
    depends_on:
      - mariadb
    networks:
      - wpnetwork
    restart: unless-stopped

  mariadb:
    build: ./requirements/mariadb
    container_name: mariadb
    #image: mariadb:latest
    #container_name: mariadb
    #environment:
     # MARIADB_DATABASE: wp
     # MARIADB_USER: wp
     # MARIADB_PASSWORD: secret
     # MARIADB_ROOT_PASSWORD: secret
      #mariadb_DATABASE: wp
      #mariadb_USER: wp
      #mariadb_PASSWORD: secret
      #mariadb_ROOT_PASSWORD: secret

    volumes:
      #- ./requirements/mariadb:/var/lib/mariadb
      #- wpfiles:/var/www/html
      - ./wordpress:/var/www/html
    networks:
      - wpnetwork
    restart: unless-stopped

networks:
  wpnetwork:
    driver: bridge

volumes:
  wpfiles: