Generic Webapp Docker Setup
This docker config is meant primarily for local development prototyping. NOT MEANT FOR PRODUCTION. The mysql config exposes its port to the host so that you can run scripts like
wordmove or even manually load/dump/debug. I primarily use this config repo for WordPress, but can be used for any PHP-based web app. See my blog for more information.
Install the following dependencies through their respective installation instructions:
Included is a .env_sample file. Since Docker and Wordmove utilize dotenv, it's convenient to define all environment variables there.
Web App Setup
- Make sure your Docker machine is running:
- After you have an IP provisioned (usually 192.168.99.100), load the docker machine environment variables
eval `docker-machine env`
- Copy the
.env_sampleinto a file
.envand provide values. Note that
LOCAL_DB_NAMEshould be the same, but it is provided separately for debugging purposes.
- Edit your Windows/Mac/Linux 'hosts' file to point the url
worpdress.localto the IP address provisioned by your docker machine.
LOCAL_DB_LOCATIONshould be set to
worpdress.localfor this reason.
- Then fire up your docker images
docker-compose up -d(I have issues with Linux and need
sudoto provision volumes/ports)
Initialize Your Web Files
The webroot folder can hold any PHP files you want. The following command installs WordPress without default plugins/themes:
wp core download --path=webroot --skip-content
You can now go to the url specified from
DOCKER_NGINX_HOST in your browser. You can set the location of your Database Host to the value
database because Docker's DNS resolver configures the name as provided in docker-compose.yml.
rsync_options in the
Movefile is set to
--no-perms --no-owner --no-group this means that rysnc will ignore permission changes in your webroot directory. This makes local development a little safer because it prevents forgotten permission 'fixes'
Star this repo if you want.