version: '2'

services:
  wordpress:
    image: wordpress
    restart: always
    container_name: wordpress
    hostname: wordpress
    environment:
      - "WORDPRESS_DB_HOST=mysql-wordpress:3306"
      - "WORDPRESS_DB_USER=wordpress"
      - "WORDPRESS_DB_PASSWORD=w0rdpr3ss."
      - "WORDPRESS_DB_NAME=wordpress"
    links:
      - mysql-wordpress
    volumes:
      - ./wordpress/wp-config.php:/usr/src/wordpress/wp-config-sample.php
      - ./wordpress/functions.php:/usr/src/wordpress/wp-includes/functions.php:ro
      - ./wordpress/header.php:/usr/src/wordpress/wp-content/themes/twentyseventeen/header.php
      - ./wordpress/footer.php:/usr/src/wordpress/wp-content/themes/twentyseventeen/footer.php
      - ./wordpress/htaccess:/var/www/html/.htaccess
      - ./wordpress/wp-content:/var/www/html/wp-content
      - ./wordpress/apache2.conf:/etc/apache2/apache2.conf:ro
      - ./wordpress/doom.svg:/var/www/html/wp-includes/images/doom.svg:ro
      - /opt/docker/production/youtube/youtube/taller.jpg:/var/www/html/wp-content/taller.jpg
    expose:
      - 80
    depends_on:
      - mysql-wordpress
    networks:
      mynet:
        ipv4_address: 172.126.0.101
        
  mysql-wordpress:
    image: mysql:5.7
    container_name: mysql-wordpress
    hostname: mysql-wordpress
    restart: always
    command: ["mysqld", "--character-set-server=utf8", "--collation-server=utf8_general_ci", "--default-time-zone=+00:00","--explicit_defaults_for_timestamp", "--default-authentication-plugin=mysql_native_password"]
    expose:
      - 3306
    environment:
      - "MYSQL_ROOT_PASSWORD=r00t"
      - "MYSQL_DATABASE=wordpress"
      - "MYSQL_USER=wordpress"
      - "MYSQL_PASSWORD=w0rdpr3ss."
    volumes:
      - ./mysql:/var/lib/mysql
    networks:
      mynet:
        ipv4_address: 172.126.0.102

networks:
  mynet:
    driver: bridge
    ipam:
      config:
      - subnet: 172.126.0.0/24

