Skip to content

martingrondein/docker-lamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Docker LAMP/LEMP Stack

  • 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.

1. Setup

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

2. Usage

Simply pop all your PHP application files in the /app folder and navigate to http://localhost. Remember Alpine uses sh rather than bash.

Quickly get into the application/PHP container

docker-compose exec -it php sh

Using Composer

 docker-compose exec -it php composer COMPOSER_COMMAND_GOES_HERE

Using NPM

 docker-compose exec -it php npm NPM_COMMAND_GOES_HERE

Using Node

 docker-compose exec -it php npm NODE_COMMAND_GOES_HERE

Modify the Nginx config

nginx/default.conf

Modify the PHP config

php/php.ini

Modify the PHP-FPM config

php/www.conf

Modify the MariaDB config

mysql/my.conf

3. FAQ

Q: Why use Alpine over Ubuntu?

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:

Q: Is this production ready?

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!

About

Simple, clean & light Dockerized LEMP (Linux, Nginx, MariaDB, PHP) stack based on Alpine

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published