Dockerfile and instructions for quick testing

This commit is contained in:
Leon 2017-02-15 06:03:49 +13:00
parent f86c92fc27
commit 5bb32b5907
3 changed files with 33 additions and 4 deletions

14
Dockerfile Normal file
View file

@ -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

16
post_launch.sh Normal file
View file

@ -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

View file

@ -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: To quickly try out the plugin, without affecting your other WordPress installations:
- [install Docker](http://docker.com) - [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 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 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 exec -it plugindevwp bash` # get CLI access to the container
- `docker-php-ext-install zip` # install zip extension for PHP, which the plugin requires - `sh /post_launch.sh` # install WP; install and activate static output plugin
- `service apache2 reload` # enables new extension to be used
- `exit` # leave the container's shell - `exit` # leave the container's shell
- `docker ps` # get WordPress container's id so you can connect from the host - `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 - `docker inspect __yourcontainerid__ | grep Address` # get IP for connecting in your browser
- open IP in browser and perform WP installation as usual - open IP in browser and you have a clean WP install, including the plugin (l/p: admin/admin)
- install the plugin by searching by its name, else go back into container and use `wp-cli` method
## Support ## Support