Skip to content

thomasnavarro/docker-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LAMP stack built with Docker Compose

A basic LAMP stack environment built using Docker Compose. It consists of the following:

  • PHP
  • Apache
  • MySQL
  • phpMyAdmin
  • Mailhog

Installation

  • Clone this repository on your local computer
  • configure .env as needed
  • Run the docker-compose up -d.
git clone https://github.com/thomasnavarro/docker-boilerplate.git
cd docker-boilerplate/
cp .env.example .env
// modify .env as needed
docker-compose up -d

Your LAMP stack is now ready!! You can access it via http://localhost:3000.

Configuration and Usage

General Information

This Docker Stack is build for local development and not for production usage.

Configuration

This package comes with default configuration options. You can modify them by creating .env file in your root directory. To make it easy, just copy the content from .env.example file and update the environment variable values as per your need.

Configuration Variables

There are following configuration variables available and you can customize them by overwritting in your own .env file.


PHP


PHPVERSION Is used to specify which PHP Version you want to use. Defaults always to latest PHP Version.

PHP_INI Define your custom php.ini modification to meet your requirments.


Apache


DOCUMENT_ROOT

It is a document root for Apache server. The default value for this is ./app. All your sites will go here and will be synced automatically.

APACHE_DOCUMENT_ROOT

Apache config file value. The default value for this is /var/www/html.

VHOSTS_DIR

This is for virtual hosts. The default value for this is ./config/vhosts. You can place your virtual hosts conf files here.

Make sure you add an entry to your system's hosts file for each virtual host.

APACHE_LOG_DIR

This will be used to store Apache logs. The default value for this is ./logs/apache2.


Database


DATABASE Define which MySQL or MariaDB Version you would like to use.

MYSQL_DATA_DIR

This is MySQL data directory. The default value for this is ./data/mysql. All your MySQL data files will be stored here.

MYSQL_LOG_DIR

This will be used to store Apache logs. The default value for this is ./logs/mysql.

Web App

Apache is configured to run on port 8080. So, you can access it via http://localhost:8080.

Apache Modules

By default following modules are enabled.

  • rewrite
  • headers

If you want to enable more modules, just update ./bin/app/Dockerfile. You have to rebuild the docker image by running docker-compose build and restart the docker containers.

Connect via SSH

You can connect to web server using docker-compose exec command to perform various operation on it. Use below command to login to container via ssh.

docker-compose exec app bash

PHP

The installed version of php depends on your .env file.

Extensions

By default following extensions are installed. May differ for PHP Verions <7.x.x

  • mysqli
  • pdo_sqlite
  • pdo_mysql
  • mbstring
  • zip
  • intl
  • mcrypt
  • curl
  • json
  • iconv
  • xml
  • xmlrpc
  • gd

If you want to install more extension, just update ./bin/app/Dockerfile. You have to rebuild the docker image by running docker-compose build and restart the docker containers.

phpMyAdmin

phpMyAdmin is configured to run on port 8081. Use following default credentials.

http://localhost:8081/
username: root
password: admin

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published