I would like to make a "replacable" docker image/machine that has less dependency as possible. So that wheneve there is a new project, I can simply download and setup a new image and start building website project right away, without spending another half day or even 1 - 2 hours just to setup and config an environment.
I am using Ubuntu 16.04, and the Apache/PHP in Ubuntu official repo. Because it is simpler to install/config/use, than using "official" image.
The main obstacle of NOT using official PHP docker image is that, if I want to install additional PHP modules, I need to use their custom commands instead of normal apt-get. To me, using Ubuntu official apt-get command and download repo from them is much easier and safer.
Please read my Dockerfile, it is much simpler than before, and give you a general idea on what I did.
It is using latest PHP 7 and latest Apache
Web file directory in Apache container is /var/www/html
Web files are stored OUTSIDE the container. By default (docker-compose.yml), you will have a html directory that saved all your files (Directory structure see below).
Docker host (the computer which you run "docker" command) opens port 80.
Apache container exposes port 80.
Visitor website traffic coming from docker host will be forward to apache container (80:80)
The name in YML is called "web", and it links to "db", which is the database (See below).
You may also see that I install Redis. And yes, my plan is to use Redis to speed up the loading time. One of my to-do item is to integrate Redis into this project.
I know, the common/best practise is to limit the available components as many as possible to prevent potential library conflicts and unnecessary performance punishment. However, the concept here is to setup an contain-everything machine FIRST, and then disable necessary libraries based on your requirements.
Based on the above concept, it is surprising to know that it is difficult to find such thing. So I decided to take the first step to create that.
I am not perfect, and neither is my Git/code/program. Therefore this docker-compose.yml and Dockerfile will be continuously optimized/re-structure so that it can benefit me, and you also.
Any suggestions/recommendations/comments are welcomed!