美文网首页
WordPress docker-compose 配置

WordPress docker-compose 配置

作者: RoyChina | 来源:发表于2020-02-27 22:08 被阅读0次
version: '3'

services:
  wp:
    container_name: jointly-wp
    restart: always 
    image: wordpress:latest # https://hub.docker.com/_/wordpress/
    ports:
      - ${IP}:80:80 # change ip if required
    volumes:
      - ./config/php.conf.ini:/usr/local/etc/php/conf.d/conf.ini
      - ./wp-app:/var/www/html # Full wordpress project
      #- ./plugin-name/trunk/:/var/www/html/wp-content/plugins/plugin-name # Plugin development
      #- ./theme-name/trunk/:/var/www/html/wp-content/themes/theme-name # Theme development
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_NAME: "${DB_NAME}"
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: "${DB_ROOT_PASSWORD}"
    depends_on:
      - db
    links:
      - db

  # wpcli:
  #   restart: always 
  #   image: wordpress:cli
  #   volumes:
  #     - ./config/php.conf.ini:/usr/local/etc/php/conf.d/conf.ini
  #     - ./wp-app:/var/www/html
  #   depends_on:
  #     - db
  #     - wp

  # pma:
  #   container_name: jointly-pma
  #   restart: always 
  #   image: phpmyadmin/phpmyadmin
  #   environment:
  #     PMA_HOST: db
  #     PMA_PORT: 3306
  #     MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"
  #   ports:
  #     - ${IP}:8088:80
  #   links:
  #     - db:db

  db:
    container_name: jointly-db
    restart: always 
    image: mysql:latest # https://hub.docker.com/_/mysql/ - or mariadb https://hub.docker.com/_/mariadb
    ports:
      - ${IP}:3306:3306 # change ip if required
    deploy:
      resources:
        limits:
          memory: 200M ### limit the memory usage, only worked when use docker stack deploy or docker-compose --compatibility up
        reservations:
          memory: 100M
    command: [
        '--default_authentication_plugin=mysql_native_password',
        '--character-set-server=utf8mb4',
        '--collation-server=utf8mb4_unicode_ci'
    ]
    volumes:
      - ./wp-data:/docker-entrypoint-initdb.d
      - ./wp-data/db-data:/var/lib/mysql
    environment:
      MYSQL_DATABASE: "${DB_NAME}"
      MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"

相关文章

网友评论

      本文标题:WordPress docker-compose 配置

      本文链接:https://www.haomeiwen.com/subject/gypfhhtx.html