Can I use docker-compose to create a one step setup for a completely installed PHP application? Since that's a pretty vague questions. I will use WordPress as an example.
If I look at the official wordpress docker repositories, I see there's already a super-useful yml file for docker-composer
version: '3.1'
services:
wordpress:
image: wordpress
restart: always
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
MYSQL_PASSWORD: examplepass
MYSQL_RANDOM_ROOT_PASSWORD: '1'
This is great and gets me a running frontend app server with WordPress already there. It also gets a database server. It sets up everything to talk to one another. That's all great.
What this doesn't get me is a fully installed WordPress. Like a lot of PHP applications, in order to be fully installed there's a few additional configuration fields that need to be set, and a few additional database fields as well.
This means I can't fully install the application until the both the wordpress and db container are fully up. I've thought about hacking up a workaround where I have the CMD or ENTRYPOINT wait around for a DB connection to be established, but the base WordPress Dockerfile(s) already uses ENTRYPOINT and CMD so that's not an option. (or is it?)
Is there an elegant, docker-ish way to do what I want to do? Or am I stuck telling my users to docker-compose up, and then run a second command to finish the installation?