Setup: Wordpress

This example demonstrates how to set up a test environment for a Wordpress website with a custom theme. This can be very useful to test a theme in a staging environment and sharing it with other people.

See the complete example code on GitHub

valist.yml

services:
  db:
    image: mysql:5.7
    environment:
      - MYSQL_ROOT_PASSWORD=somewordpress
      - MYSQL_DATABASE=wordpress
      - MYSQL_USER=wordpress
      - MYSQL_PASSWORD=wordpress
  wordpress:
    dockerfile: Dockerfile
    public: true
    port: 80
    environment:
      - WORDPRESS_DB_HOST=db:3306
      - WORDPRESS_DB_USER=wordpress
      - WORDPRESS_DB_PASSWORD=wordpress
      - WORDPRESS_DB_NAME=wordpress
    depends_on:
      - db

Dockerfile

This uses a custom Dockerfile which is using the default Wordpress image but also copies over a custom theme to the folder holding the themes in Wordpress.

FROM wordpress:latest
COPY theme /var/www/html/wp-content/themes/customtheme

Last updated

Was this helpful?