From 5bb32b5907120b718daea634d3e685e095f1fde9 Mon Sep 17 00:00:00 2001 From: Leon Date: Wed, 15 Feb 2017 06:03:49 +1300 Subject: [PATCH] Dockerfile and instructions for quick testing --- Dockerfile | 14 ++++++++++++++ post_launch.sh | 16 ++++++++++++++++ readme.md | 7 +++---- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 Dockerfile create mode 100644 post_launch.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..596826eb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM wordpress:latest + +RUN apt-get update \ +& docker-php-ext-install zip + + +# install wp cli + +RUN curl -L https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -o /usr/local/bin/wp +RUN chmod +x /usr/local/bin/wp + +COPY post_launch.sh /post_launch.sh + + diff --git a/post_launch.sh b/post_launch.sh new file mode 100644 index 00000000..cf706a34 --- /dev/null +++ b/post_launch.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# run wp-cli cmds from wp install path +cd /var/www/html + +# install default +wp --allow-root core install --url='172.17.0.3' --title='wp plugindev' --admin_user=admin --admin_password=admin --admin_email=blah@blah.com --skip-email + +# install static plugin +wp --allow-root plugin install static-html-output-plugin --activate + +#TODO: option to use local app folder vs pulling plugin from web + +# run continual process to keep container alive without daemonizing +tail -f /var/log/apache2/error.log + diff --git a/readme.md b/readme.md index 194bdc66..ac1e0e33 100644 --- a/readme.md +++ b/readme.md @@ -29,16 +29,15 @@ If you'd like to contribute, please follow the usual GitHub procedures (create a To quickly try out the plugin, without affecting your other WordPress installations: - [install Docker](http://docker.com) + - `docker build -t leonstafford/wordpress-static-html-plugin:latest # add zip extension and WP cli on top of latest WordPress Docker image - `docker run --name devmysql -e MYSQL_ROOT_PASSWORD=banana -d mariadb` # run a MySQL container for the WordPress one to later use - `docker run --name plugindevwp --link devmysql:mysql -p 8080:80 -d wordpress` # run the official WordPress image, linking to your MySQL instance - `docker exec -it plugindevwp bash` # get CLI access to the container - - `docker-php-ext-install zip` # install zip extension for PHP, which the plugin requires - - `service apache2 reload` # enables new extension to be used + - `sh /post_launch.sh` # install WP; install and activate static output plugin - `exit` # leave the container's shell - `docker ps` # get WordPress container's id so you can connect from the host - `docker inspect __yourcontainerid__ | grep Address` # get IP for connecting in your browser - - open IP in browser and perform WP installation as usual - - install the plugin by searching by its name, else go back into container and use `wp-cli` method + - open IP in browser and you have a clean WP install, including the plugin (l/p: admin/admin) ## Support