Code Monkey home page Code Monkey logo

docker-wordpress's Introduction

WordPress Docker Image

This is an image to help on plugins and themes development, but it can be used to host a WordPress site as well. There are some tools and nice librarys included, like OPCache, X-Debug and WP-Cli.

Overriding configurations

You can override wp-config.php values by using environment variables. Actually, the variables present on wp-config.php and values when variable is not defined are below.

Variable Name Default Value
HTTPS
WORDPRESS_AUTH_KEY <random string>
WORDPRESS_AUTH_SALT <random string>
WORDPRESS_LOGGED_IN_KEY <random string>
WORDPRESS_LOGGED_IN_SALT <random string>
WORDPRESS_NONCE_SALT <random string>
WORDPRESS_SECURE_AUTH_KEY <random string>
WORDPRESS_SECURE_AUTH_SALT <random string>
WORDPRESS_NONCE_KEY <random string>
WORDPRESS_DB_CHARSET utf8
WORDPRESS_DB_COLLATE
WORDPRESS_DB_HOST mysql
WORDPRESS_DB_NAME wordpress
WORDPRESS_DB_PASSWORD wordpress
WORDPRESS_DB_USER wordpress
WORDPRESS_DEBUG false
WORDPRESS_DEBUG_DISPLAY false
WORDPRESS_DEBUG_LOG false
WORDPRESS_FS_METHOD direct
WORDPRESS_TABLE_PREFIX wp_
WORDPRESS_HOME <?= $_SERVER['SERVER_NAME']; ?>
WORDPRESS_SITEURL <?= $_SERVER['SERVER_NAME']; ?>
WORDPRESS_USERNAME admin
WORDPRESS_PASSWORD changeme
WORDPRESS_EMAIL [email protected]
WORDPRESS_FIRST_NAME WordPress
WORDPRESS_LAST_NAME Administrator
WORDPRESS_BLOG_NAME My Docker Blog

Overriding variables not defined on wp-config.php

If you have variables not present on table above, you can mount a folder with your configuration at /var/www/html/wp-config.d. All php files on that directory will be included on wp-config.php. You can also override variables present on default wp-config.php.

Parental advisory

If you are running behind a reverse proxy and inside a Virtual Host, you may be safe about WORDPRESS_HOME and WORDPRESS_SITEURL default values.

But if you container receive requests with unexpected SERVER_NAME, you must provide values for those variables.

In any case, it is a good idea to provide values for those variables.

Development environment

There are a WordPress installed at /var/www/html. So if you want to develop a plugin, you can mount your content mapping your plugin folder in /var/www/html/wp-content/plugins.

Let's suppose you want to test your plugin called Awesome, your docker-compose.yml should be like this below.

version: '2'

services:
  web:
    image: hacklab/wordpress
    environment:
      - WORDPRESS_DEBUG=true
      - WORDPRESS_DB_USER=the_db_user
      - WORDPRESS_DB_PASSWORD=the_db_pass
      - WORDPRESS_DB_NAME=the_db_name
    ports:
      - "80:80"

  mysql:
    image: mariadb
    environment:
      - MYSQL_USER=the_db_user
      - MYSQL_PASSWORD=the_db_pass
      - MYSQL_DATABASE=the_db_name
      - MYSQL_ROOT_PASSWORD=the_root_pass
      - TERM=xterm

X-Debug

When you set WORDPRESS_DEBUG=true in container environment, the X-Debug configuration will be created automatically, and the container will receive connections from any host. If you want suppress X-Debug, set an enviroment variable with false value, like XDEBUG=false.

Atom users

Tell your Atom about folder mapping by editing config.cson. You have to configure the section called "php-debug". It should look like this:

  "php-debug":
    PathMaps: [
      "remotepath;localpath"
      "/var/www/html/;/local/path/to/wordpress/"
    ]
    PhpException:
      CatchableFatalError: false
      Deprecated: false
      FatalError: false
      Notice: false
      ParseError: false
      StrictStandards: false
      UnknownError: false
      Warning: false
      Xdebug: false
    ServerPort: 9000

Modules enabled by default

The modules below are used on most of hacklab WordPress projects and probably may be useful for wide range of projects. While modules can take a lot of memory for each Apache process, the modules below enable users to take advantage of a lot of WordPress Cache plugins, like W3 Total Cache.

  • apcu
  • calendar
  • Core
  • ctype
  • curl
  • date
  • dom
  • fileinfo
  • filter
  • ftp
  • gd
  • hash
  • iconv
  • json
  • libxml
  • mbstring
  • mcrypt
  • memcached
  • mysqli
  • mysqlnd
  • openssl
  • pcre
  • PDO
  • pdo_mysql
  • pdo_sqlite
  • Phar
  • posix
  • readline
  • redis
  • Reflection
  • session
  • SimpleXML
  • sockets
  • SPL
  • sqlite3
  • standard
  • tokenizer
  • xml
  • xmlreader
  • xmlwriter
  • zip
  • zlib

docker-wordpress's People

Contributors

anatrino avatar fabiomontefuscolo avatar leopiccionia avatar rafaelchavesfreitas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.