Dockerizing a sample app in more than 1 containers

Here’s my app https://github.com/tenzan/testapp

It’s sample app that consists from:

  1. index.php
  2. nginx.conf
  3. sample.sql

I want to make a development environment in Docker and I assume I will need to create 3 containers:

  1. The app itself (this is where index.php will reside)
  2. Web server based on Nginx (this is where nginx.conf goes)
  3. DB server based on MySQL (this is where sample.sql goes)

and link containers in the way:

  1. Application <–> Web server
  2. Application <–> DB server

Questions:

  1. If the thoughts above are correct?
  2. Will I have to create one Dockerfile per container or is it possible to create 3 containers with one Dockerfile?

PS: I believe this work will be very helpful to other people so I will keep it accessible.