Sign inSign up

gsandf/wordpress-docker-starter

By gsandf

•Updated almost 8 years ago
Archived

Wordpress Docker Starter Kit

Image
2

458

gsandf/wordpress-docker-starter repository overview

⁠Wordpress Docker Starter Kit

⁠Example

The only thing you need to get started is a docker-compose.yml file:

version: '2'
services:
  wordpress:
    image: visiblevc/wordpress:latest
    ports:
      - 8080:80
      - 443:443
    volumes:
      - ./wp-content/uploads:/app/wp-content/uploads
      - ./yourplugin:/app/wp-content/plugins/yourplugin # Plugin development
      - ./yourtheme:/app/wp-content/themes/yourtheme   # Theme development
    environment:
      WORDPRESS_DB_HOST: host
      WORDPRESS_DB_USER: user
      WORDPRESS_DB_PASSWORD: password
      WORDPRESS_DB_NAME: dbname
      PLUGINS: >-
        academic-bloggers-toolkit,
        co-authors-plus,
        [WP-API]https://github.com/WP-API/WP-API/archive/master.zip,
        [local]my-local-plugin
      THEMES: >-
        [local]my-local-theme
      SEARCH_REPLACE: yoursite.com,localhost:8080
      WP_DEBUG: 'true'
volumes:
  data: {}

Need PHPMyAdmin? Add it as a service

version: '2'
services:
  wordpress:
    # same as above
  db:
    # same as above
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    environment:
      MYSQL_ROOT_PASSWORD: root
    ports:
      - 22222:80
volumes:
  data:
⁠Service Environment Variables

Notes:

  • Variables marked with ✅ are required
  • Single quotes must surround boolean environment variables
⁠wordpress
VariableDefault ValueDescription
ADMIN_EMAILadmin@${DB_NAME}.comAdministrator email address
WP_DEBUG'false'Click here⁠ for more information
WP_DEBUG_DISPLAY'false'Click here⁠ for more information
WP_DEBUG_LOG'false'Click here⁠ for more information
WP_VERSIONlatestSpecify the WordPress version to install. Accepts any valid semver number, latest, or nightly for beta builds.
THEMESComma-separated list of themes you want to install in either of the following forms
  • theme-slug: Used when installing theme direct from WordPress.org
  • [theme-slug]https://themesite.com/theme.zip: Used when installing theme from URL
  • [local]theme-slug: Used when you have the theme downloaded to a local folder that you have volumed to the ./wp-content/themes directory.
PLUGINSComma-separated list of plugins you want to install in either of the following forms:
  • plugin-slug: Used when installing plugin direct from WordPress.org.
  • [plugin-slug]http://pluginsite.com/plugin.zip: Used when installing plugin from URL.
  • [local]plugin-slug: Used when you have the plugin downloaded to a local folder that you have volumed to the ./wp-content/plugins directory.
MULTISITE'false'Set to 'true' to enable multisite
PERMALINKS/%year%/%monthnum%/%postname%/A valid WordPress permalink structure tag⁠
SEARCH_REPLACEComma-separated string in the form of current-url,replacement-url
  • When defined, current-url will be replaced with replacement-url on build (useful for development environments utilizing a database copied from a live site)
  • Note: If you are running Docker using Docker Machine, your replacement url MUST be the output of the following command: echo $(docker-machine ip <your-machine-name>):8080
VERBOSE'false'Set to 'true' to run build with verbose logging

⁠Workflow Tips

⁠Using wp-cli

You can access wp-cli by running npm run wp .... Here are some examples:

npm run wp plugin install <some-plugin>
npm run wp db import /data/database.sql
⁠Working with Databases

Sometimes your development environment runs on a different domain than your live one. The live will be example.com and the development localhost:8080. This project does a search and replace for you. You can set the SEARCH_REPLACE: example.com,localhost:8080 environment variable in the docker-compose.yml.

Tag summary

Content type

Image

Digest

Size

180.5 MB

Last updated

almost 8 years ago

docker pull gsandf/wordpress-docker-starter