- Alpine based.
- Built using latest (yet stable) versions of PHP 8.1 FPM, Nginx, Node, Composer and MariaDB.
- Built using best practises (to my knowledge at the time).
- Nginx, MariaDB and PHP have been graciously optimized.
- Exposed and easy to tweak PHP-FPM and Nginx config variables.
- Neatly formatted, organised and commented Dockerfile.
- Also included are initial variables to easily swap out for new versions.
Ensure you have Docker installed and then run:
git clone https://github.com/martingrondein/docker-lamp.git
mv .env.sample .env
docker-compose up -d
Simply pop all your PHP application files in the /app
folder and navigate to http://localhost
. Remember Alpine uses sh
rather than bash
.
docker-compose exec -it php sh
docker-compose exec -it php composer COMPOSER_COMMAND_GOES_HERE
docker-compose exec -it php npm NPM_COMMAND_GOES_HERE
docker-compose exec -it php npm NODE_COMMAND_GOES_HERE
nginx/default.conf
php/php.ini
php/www.conf
mysql/my.conf
A: Alpine images are lightweight and have a smaller attack surfaces. When there’s not a lot of packages and libraries on your system, there’s very little that can go wrong. It comes with a lot less bloat and when it comes to using it in Docker, build times also seem faster.
Some articles to support this claim:
- You Should Use Alpine Linux Instead of Ubuntu
- The 3 Biggest Wins When Using Alpine as a Base Docker Image
A: Not yet tested in a production environment! But I believe with a few additional security tweaks and hardening, it may be nearly good enough to go!