Pascal PELISSIER 3 years ago
parent
commit
2a4fd6f2c8
4 changed files with 136 additions and 56 deletions
  1. 7
    0
      .gitignore
  2. 94
    13
      README.md
  3. 27
    37
      bin/webserver/Dockerfile
  4. 8
    6
      docker-compose.yml

+ 7
- 0
.gitignore View File

@@ -0,0 +1,7 @@
1
+/.env
2
+/.vscode
3
+/config/*
4
+/data/*
5
+/logs/*
6
+/www/**
7
+.DS_Store

+ 94
- 13
README.md View File

@@ -1,33 +1,114 @@
1
-# Logipro - LAMP stack built with Docker Compose
1
+# LAMP stack built with Docker Compose
2 2
 
3 3
 ![Landing Page](https://preview.ibb.co/gOTa0y/LAMP_STACK.png)
4 4
 
5 5
 This is a basic LAMP stack environment built using Docker Compose. It consists following:
6 6
 
7
-* PHP
8
-* Apache
9
-* MySQL
7
+* PHP 5.6
8
+* Apache 2.4
9
+* MySQL 5.7
10 10
 * phpMyAdmin
11 11
 
12
-As of now, we have 3 different branches for different PHP versions. Use appropriate branch as per your php version need:
13
-* [5.6.x](https://github.com/sprintcube/docker-compose-lamp/tree/5.6.x)
14
-* [7.1.x](https://github.com/sprintcube/docker-compose-lamp/tree/7.1.x)
15
-* [7.2.x](https://github.com/sprintcube/docker-compose-lamp/tree/7.2.x)
16
-
17 12
 ## Installation
18 13
 
19
-Clone this repository on your local computer and checkout the appropriate branch e.g. 7.1.x. Run the `docker-compose up -d`.
14
+Clone this repository on your local computer. Run the `docker-compose up -d`.
20 15
 
21 16
 ```shell
22 17
 git clone https://github.com/sprintcube/docker-compose-lamp.git
23 18
 cd docker-compose-lamp/
24 19
 git fetch --all
25
-git checkout 7.1.x
20
+git checkout 5.6.x
26 21
 docker-compose up -d
27 22
 ```
23
+> Please make sure that you are using `5.6.x` branch.
28 24
 
29 25
 Your LAMP stack is now ready!! You can access it via `http://localhost`.
30 26
 
31
-## Configuration and Usage
27
+## Configuration
28
+
29
+This package comes with default configuration options. You can modify them by creating `.env` file in your root directory.
30
+
31
+To make it easy, just copy the content from `sample.env` file and update the environment variable values as per your need.
32
+
33
+### Configuration Variables
34
+
35
+There are following configuration variables available and you can customize them by overwritting in your own `.env` file.
36
+
37
+_**DOCUMENT_ROOT**_
38
+
39
+It is a document root for Apache server. The default value for this is `./www`. All your sites will go here and will be synced automatically.
40
+
41
+_**MYSQL_DATA_DIR**_
42
+
43
+This is MySQL data directory. The default value for this is `./data/mysql`. All your MySQL data files will be stored here.
44
+
45
+_**VHOSTS_DIR**_
46
+
47
+This is for virtual hosts. The default value for this is `./config/vhosts`. You can place your virtual hosts conf files here.
48
+
49
+> Make sure you add an entry to your system's `hosts` file for each virtual host.
50
+
51
+_**APACHE_LOG_DIR**_
52
+
53
+This will be used to store Apache logs. The default value for this is `./logs/apache2`.
54
+
55
+_**MYSQL_LOG_DIR**_
56
+
57
+This will be used to store Apache logs. The default value for this is `./logs/mysql`.
58
+
59
+## Web Server
60
+
61
+Apache is configured to run on port 80. So, you can access it via `http://localhost`.
62
+
63
+#### Apache Modules
64
+
65
+By default following modules are enabled.
66
+
67
+* rewrite
68
+* headers
69
+
70
+> If you want to enable more modules, just update `./bin/webserver/Dockerfile`. You can also generate a PR and we will merge if seems good for general purpose.
71
+> You have to rebuild the docker image by running `docker-compose build` and restart the docker containers.
72
+
73
+#### Connect via SSH
74
+
75
+You can connect to web server using `docker exec` command to perform various operation on it. Use below command to login to container via ssh.
76
+
77
+```shell
78
+docker exec -it png-webserver /bin/bash
79
+```
80
+
81
+## PHP
82
+
83
+The installed version of PHP is 5.6.
84
+
85
+#### Extensions
86
+
87
+By default following extensions are installed.
88
+
89
+* mysqli
90
+* mbstring
91
+* zip
92
+* intl
93
+* mcrypt
94
+* curl
95
+* json
96
+* iconv
97
+* xml
98
+* xmlrpc
99
+* gd
100
+
101
+> If you want to install more extension, just update `./bin/webserver/Dockerfile`. You can also generate a PR and we will merge if seems good for general purpose.
102
+> You have to rebuild the docker image by running `docker-compose build` and restart the docker containers.
103
+
104
+## phpMyAdmin
105
+
106
+phpMyAdmin is configured to run on port 8080. Use following default credentials.
107
+
108
+http://localhost:8080/  
109
+username: root  
110
+password: tiger
111
+
112
+## Redis
32 113
 
33
-Please read from appropriate version branch.
114
+It comes with Redis. It runs on default port `6379`.

+ 27
- 37
bin/webserver/Dockerfile View File

@@ -1,46 +1,36 @@
1
-FROM php:7.1.20-apache
1
+FROM php:5.6-apache
2 2
 
3
-RUN apt-get -y update --fix-missing
4
-RUN apt-get upgrade -y
3
+RUN apt-get -y update && apt-get upgrade -y
5 4
 
6
-# Install useful tools
7
-RUN apt-get -y install apt-utils nano wget dialog
8
-
9
-# Install important libraries
10
-RUN apt-get -y install --fix-missing apt-utils build-essential git curl libcurl3 libcurl3-dev zip
5
+# Install tools && libraries
6
+RUN apt-get -y install --fix-missing apt-utils nano wget dialog \
7
+    build-essential git curl libcurl3 libcurl3-dev zip \
8
+    libmcrypt-dev libsqlite3-dev libsqlite3-0 mysql-client \
9
+    zlib1g-dev libicu-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
10
+    && rm -rf /var/lib/apt/lists/*
11 11
 
12 12
 # Composer
13 13
 RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
14 14
 
15
-# Install xdebug
16
-RUN pecl install xdebug-2.5.0
17
-RUN docker-php-ext-enable xdebug
18
-
19
-# Other PHP7 Extensions
20
-
21
-RUN apt-get -y install libmcrypt-dev
22
-RUN docker-php-ext-install mcrypt
23
-
24
-RUN apt-get -y install libsqlite3-dev libsqlite3-0 mysql-client
25
-RUN docker-php-ext-install pdo_mysql 
26
-RUN docker-php-ext-install pdo_sqlite
27
-RUN docker-php-ext-install mysqli
28
-
29
-RUN docker-php-ext-install curl
30
-RUN docker-php-ext-install tokenizer
31
-RUN docker-php-ext-install json
32
-
33
-RUN apt-get -y install zlib1g-dev
34
-RUN docker-php-ext-install zip
35
-
36
-RUN apt-get -y install libicu-dev
37
-RUN docker-php-ext-install -j$(nproc) intl
38
-
39
-RUN docker-php-ext-install mbstring
40
-
41
-RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
42
-RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 
43
-RUN docker-php-ext-install -j$(nproc) gd
15
+# PHP5 Extensions
16
+RUN docker-php-ext-install curl \
17
+    && docker-php-ext-install tokenizer \
18
+    && docker-php-ext-install json \
19
+    && docker-php-ext-install mcrypt \
20
+    && docker-php-ext-install pdo_mysql \
21
+    && docker-php-ext-install pdo_sqlite \
22
+    && docker-php-ext-install mysqli \
23
+    && docker-php-ext-install zip \
24
+    && docker-php-ext-install -j$(nproc) intl \
25
+    && docker-php-ext-install mbstring \
26
+    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
27
+    && docker-php-ext-install -j$(nproc) gd \
28
+    && pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug \
29
+    && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/php.ini
44 30
 
45 31
 # Enable apache modules
46 32
 RUN a2enmod rewrite headers
33
+
34
+EXPOSE 80
35
+
36
+ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

+ 8
- 6
docker-compose.yml View File

@@ -4,7 +4,7 @@ services:
4 4
   webserver:
5 5
     build: 
6 6
       context: ./bin/webserver
7
-    container_name: 'png-webserver'
7
+    container_name: '5.6.x-webserver'
8 8
     restart: 'always'
9 9
     ports:
10 10
       - "80:80"
@@ -18,7 +18,7 @@ services:
18 18
       - ${LOG_DIR-./logs/apache2}:/var/log/apache2
19 19
   mysql:
20 20
     build: ./bin/mysql
21
-    container_name: 'png-mysql'
21
+    container_name: '5.7-mysql'
22 22
     restart: 'always'
23 23
     ports:
24 24
       - "3306:3306"
@@ -27,12 +27,9 @@ services:
27 27
       - ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql
28 28
     environment:
29 29
       MYSQL_ROOT_PASSWORD: tiger
30
-      MYSQL_DATABASE: png
31
-      MYSQL_USER: png
32
-      MYSQL_PASSWORD: png
33 30
   phpmyadmin:
34 31
     image: phpmyadmin/phpmyadmin
35
-    container_name: 'png-phpmyadmin'
32
+    container_name: 'sc-phpmyadmin'
36 33
     links:
37 34
       - mysql
38 35
     environment:
@@ -42,3 +39,8 @@ services:
42 39
       - '8080:80'
43 40
     volumes: 
44 41
       - /sessions
42
+  redis:
43
+    container_name: 'sc-redis'
44
+    image: redis:latest
45
+    ports:
46
+      - "6379:6379"

Loading…
Cancel
Save