Make WordPress Core


Ignore:
Timestamp:
08/05/2019 07:09:14 AM (5 years ago)
Author:
pento
Message:

Build Tools: Add a WordPress Development Environment.

This commit adds the first iteration of a Docker-based config for setting up a local WordPress development environment.

Props pento, noisysocks, mcsf, pbearne, isabel_brison.
See #47767.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/local-env/docker-compose.yml

    r45570 r45745  
    1 version: '3.1'
     1version: '3.7'
    22
    33services:
    4   wordpress:
    5     image: wordpress
    6     restart: always
     4
     5  ##
     6  # The web server container.
     7  ##
     8  wordpress-develop:
     9    image: nginx:alpine
     10
     11    networks:
     12      - wpdevnet
     13
    714    ports:
    8       - 8889:80
     15      - ${LOCAL_PORT-8889}:80
     16
    917    environment:
    10       WORDPRESS_DB_HOST: mysql
    11       WORDPRESS_DB_PASSWORD: example
    12       ABSPATH: /usr/src/wordpress/
    13       WORDPRESS_DEBUG: 1
    14       WORDPRESS_CONFIG_EXTRA: |
    15         define( 'SCRIPT_DEBUG', true );
     18      LOCAL_DIR: ${LOCAL_DIR-src}
     19
    1620    volumes:
    17       - wordpress_data:/var/www/html
    18       - ../../build/:/var/www/html/
     21      - ./default.template:/etc/nginx/conf.d/default.template
     22      - ../../:/var/www
     23
     24    # Load our config file, substituning environment variables into the config.
     25    command: /bin/sh -c "envsubst '$$LOCAL_DIR' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"
     26
     27    depends_on:
     28      - php
     29
     30  ##
     31  # The PHP container.
     32  ##
     33  php:
     34    image: wordpressdevelop/php:${LOCAL_PHP-latest}
     35
     36    networks:
     37      - wpdevnet
     38
     39    environment:
     40      LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
     41
     42    volumes:
     43      - ./php-config.ini:/usr/local/etc/php/conf.d/php-config.ini
     44      - ../../:/var/www
     45
    1946    depends_on:
    2047      - mysql
    2148
    22   cli:
    23     image: wordpress:cli
    24     restart: always
    25     user: xfs
     49  ##
     50  # The MySQL container.
     51  ##
     52  mysql:
     53    image: mysql:${LOCAL_MYSQL-latest}
     54
     55    networks:
     56      - wpdevnet
     57
     58    environment:
     59      MYSQL_ROOT_PASSWORD: password
     60
    2661    volumes:
    27       - wordpress_data:/var/www/html
    28       - ../../build/:/var/www/html/
    29     depends_on:
    30       - mysql
    31       - wordpress
     62      - ./mysql-init.sql:/docker-entrypoint-initdb.d/mysql-init.sql
     63      - mysql:/var/lib/mysql
    3264
    33   mysql:
    34     image: mysql:5.7
    35     restart: always
    36     environment:
    37       MYSQL_ROOT_PASSWORD: example
    38       MYSQL_DATABASE: wordpress_test
     65    # For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
     66    command: --default-authentication-plugin=mysql_native_password
    3967
    4068volumes:
    41   wordpress_data:
     69  # So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
     70  mysql: {}
     71
     72networks:
     73  # Creating our own network allows us to connect between containers using their service name.
     74  wpdevnet:
     75    driver: bridge
Note: See TracChangeset for help on using the changeset viewer.