hoepfner-digital / wp-sail
Docker files for running a basic WordPress application. Derived from Wordpress Sail
Requires
- php: ^7.3|^8.0
- illuminate/contracts: ^8.0|^9.0
- illuminate/support: ^8.0|^9.0
- wp-cli/wp-cli: ^2.7
README
WP Sail provides a Docker powered local development experience that is compatible with macOS, Windows (WSL2), and Linux.
Based on Laravel Sail and wordpress-sail.
Inspiration
Laravel Sail is inspired by and derived from Vessel by Chris Fidao. If you're looking for a thorough introduction to Docker, check out Chris' course: Shipping Docker.
In addition to modifications already made by Ethan Clevenger I just want to have a basis to use patchfiles for updates. Also im looking into implementing Devcontainer.
Sail customization
Add Wordpress command line interface for Wordpress to Container
WP-CLI needs to be added as global binary.
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x wp-cli.phar \
&& mv wp-cli.phar /usr/local/bin/wp
Use PHP's built-in web server serving from WP-CLI
To use the built-in web server from WP-CLI change the supervisord configuration.
command=/usr/bin/php -d variables_order=EGPCS /usr/local/bin/wp server --docroot=/var/www/html/web/ --host=0.0.0.0 --port=80
Composer dependencies
Remove unnecessary dependency illuminate/console
. Add wp-cli/wp-cli
as future console.
Installation Routine
Make the installation routine in src/Console compatible with WP-CLI. Also add those commands to WP-CLI via composers autoloader.
How to use
Setup the initial project strucute
composer create-project roots/bedrock wp-project
composer require hoepfner-digital/wp-sail
Make sure the local autoload is required as part of the WP-CLI lifecycle
# in wp-cli.yml
require:
- vendor/autoload.php
Create the docker-compose.yml file
vendor/bin/wp sail:install
# with the services you want, by default MySQL and Mailhog will be installed
vendor/bin/wp sail:install --with=mysql,mailhog,redis
Build the containers
sail up
# or re-build containers
sail build --no-cache
License
Laravel Sail is open-sourced software licensed under the MIT license.