version: '3.6' services: wordpress: build: ./wordpress/apache volumes: - ~/wordpress/data:/var/www/html depends_on: - db ports: - 8080:80 # change to 80:80 when the shop is ready to go live - 4443:443 # change to 80:80 when the shop is ready to go live restart: always env_file: ".env" db: image: mysql:5.7 volumes: - ~/wordpress/database:/var/lib/mysql restart: always env_file: ".env" wordpress-cli: depends_on: - db - wordpress image: wordpress:cli # vstm: This is required to run wordpress-cli with the same # user-id as wordpress. This way there are no permission problems # when running the cli user: '33' # vstm: The sleep 10 is required so that the command is run after # mysql is initialized. Depending on your machine this might take # longer or it can go faster. command: > /bin/sh -c ' sleep 10; wp user list' # vstm: add shared volume volumes: - ~/wordpress/data:/var/www/html # WP CLI needs the environment variables used for the Wordpress image env_file: ".env"