WordPress theme and maps for tampamonitor.com
This directory may be added to wp-content/themes
and activated in the admin. For local development and testing, see below
The project is self-contained to allow you to spin up a local development enviornment, retaining your work and keeping a persistent database until no-longer needed.
First you will need to install Docker for Mac. If you are new to using Docker, we recommend getting familiar with their Docker for Mac [documentation] basics. Worry not, to get up and running you need a couple of basic commands provided here.
You'll also want to make sure Node is installed
Edit the .env
file to change the default IP address, MySQL root password and WordPress database name if necessary.
Open a terminal and cd
to the folder in which docker-compose.yml
is saved and run:
docker-compose up
This creates two new folders next to your docker-compose.yml
file.
wp-data
– used to store and restore database dumpswp-app
– the location of your WordPress application
The containers are now built and running. You should be able to access the WordPress installation with the configured IP in the browser address. By default http://127.0.0.1
.
For convenience you may add a new entry into your hosts file.
sudo nano /etc/hosts
and then add 127.0.0.1 tampamonitor.local
to the end of the file where tampamonitor
is the local project directory you are working on. You can change the URL in the database or add to the wp-app/wp-config.php
define('WP_HOME','http://tampamonitor.local');
define('WP_SITEURL','http://tampamonitor.local');
You can start the containers with the up
command in daemon mode (by adding -d
as an argument) or by using the start
command:
docker-compose start
docker-compose stop
To stop and remove all the containers use thedown
command:
docker-compose down
Use -v
if you need to remove the database volume which is used to persist the database:
docker-compose down -v
The docker compose configuration also provides a service for using the WordPress CLI.
Sample command to install WordPress:
docker-compose run --rm wpcli core install --url=http://localhost --title=test --admin_user=admin [email protected]
Or to list installed plugins:
docker-compose run --rm wpcli plugin list
For an easier usage you may consider adding an alias for the CLI:
alias wp="docker-compose run --rm wpcli"
This way you can use the CLI command above as follows:
wp plugin list
You can also visit http://127.0.0.1:8080
to access phpMyAdmin after starting the containers.
The default username is root
, and the password is the same as supplied in the .env
file.
To install PHP Codesniffer and WordPress Coding Standards run composer install
.
For PostCSS pre-processing, npm i
to install dependencies and npm start
or npm build
. Start will watch for changes and rebuild and minify style.css
, build is a one off run of.
Want to contribute? Great, thanks! If you haven't already, please open an issue first. I'm using a general gitflow, but if you have any questions, please direct them in your PR or issue. Again, thank you for considering contributing.
- Sane Docker starting point and documentation.