Browse Source

init 7.2.0

Pascal PELISSIER 3 years ago
parent
commit
8901a07496
5 changed files with 78 additions and 49 deletions
  1. 0
    7
      .gitignore
  2. 5
    8
      README.md
  3. 39
    27
      bin/webserver/Dockerfile
  4. 14
    6
      docker-compose.yml
  5. 20
    1
      sample.env

+ 0
- 7
.gitignore View File

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

+ 5
- 8
README.md View File

@@ -1,26 +1,23 @@
1 1
 # LAMP stack built with Docker Compose
2 2
 
3
-![Landing Page](https://preview.ibb.co/gOTa0y/LAMP_STACK.png)
4
-
5 3
 This is a basic LAMP stack environment built using Docker Compose. It consists following:
6 4
 
7
-* PHP 5.6
5
+* PHP 7.2
8 6
 * Apache 2.4
9 7
 * MySQL 5.7
10 8
 * phpMyAdmin
11 9
 
12 10
 ## Installation
13 11
 
14
-Clone this repository on your local computer. Run the `docker-compose up -d`.
12
+Clone this repository on your local computer and switch to branch `7.2.x`. Run the `docker-compose up -d`.
15 13
 
16 14
 ```shell
17 15
 git clone https://github.com/sprintcube/docker-compose-lamp.git
18 16
 cd docker-compose-lamp/
19 17
 git fetch --all
20
-git checkout 5.6.x
18
+git checkout 7.2.x
21 19
 docker-compose up -d
22 20
 ```
23
-> Please make sure that you are using `5.6.x` branch.
24 21
 
25 22
 Your LAMP stack is now ready!! You can access it via `http://localhost`.
26 23
 
@@ -75,12 +72,12 @@ By default following modules are enabled.
75 72
 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 73
 
77 74
 ```shell
78
-docker exec -it png-webserver /bin/bash
75
+docker exec -it 7.2.x-webserver /bin/bash
79 76
 ```
80 77
 
81 78
 ## PHP
82 79
 
83
-The installed version of PHP is 5.6.
80
+The installed version of PHP is 7.2
84 81
 
85 82
 #### Extensions
86 83
 

+ 39
- 27
bin/webserver/Dockerfile View File

@@ -1,36 +1,48 @@
1
-FROM php:5.6-apache
1
+FROM php:7.2-apache
2 2
 
3
-RUN apt-get -y update && apt-get upgrade -y
3
+RUN apt-get -y update --fix-missing
4
+RUN apt-get upgrade -y
4 5
 
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/*
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 openssl
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
-# 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
15
+# Install xdebug
16
+RUN pecl install xdebug-2.6.0
17
+RUN docker-php-ext-enable xdebug
30 18
 
31
-# Enable apache modules
32
-RUN a2enmod rewrite headers
19
+# Install redis
20
+RUN pecl install redis-4.0.1
21
+RUN docker-php-ext-enable redis
22
+
23
+# Other PHP7 Extensions
24
+
25
+RUN apt-get -y install libsqlite3-dev libsqlite3-0 mysql-client
26
+RUN docker-php-ext-install pdo_mysql 
27
+RUN docker-php-ext-install pdo_sqlite
28
+RUN docker-php-ext-install mysqli
29
+
30
+RUN docker-php-ext-install curl
31
+RUN docker-php-ext-install tokenizer
32
+RUN docker-php-ext-install json
33 33
 
34
-EXPOSE 80
34
+RUN apt-get -y install zlib1g-dev
35
+RUN docker-php-ext-install zip
35 36
 
36
-ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
37
+RUN apt-get -y install libicu-dev
38
+RUN docker-php-ext-install -j$(nproc) intl
39
+
40
+RUN docker-php-ext-install mbstring
41
+RUN docker-php-ext-install gettext
42
+
43
+RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
44
+RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 
45
+RUN docker-php-ext-install -j$(nproc) gd
46
+
47
+# Enable apache modules
48
+RUN a2enmod rewrite headers

+ 14
- 6
docker-compose.yml View File

@@ -4,11 +4,11 @@ services:
4 4
   webserver:
5 5
     build: 
6 6
       context: ./bin/webserver
7
-    container_name: '5.6.x-webserver'
7
+    container_name: '7.2.x-webserver'
8 8
     restart: 'always'
9 9
     ports:
10
-      - "80:80"
11
-      - "443:443"
10
+      - "${HOST_MACHINE_UNSECURE_HOST_PORT}:80"
11
+      - "${HOST_MACHINE_SECURE_HOST_PORT}:443"
12 12
     links: 
13 13
       - mysql
14 14
     volumes: 
@@ -21,12 +21,15 @@ services:
21 21
     container_name: '5.7-mysql'
22 22
     restart: 'always'
23 23
     ports:
24
-      - "3306:3306"
24
+      - "${HOST_MACHINE_MYSQL_PORT}:3306"
25 25
     volumes: 
26 26
       - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql
27 27
       - ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql
28 28
     environment:
29
-      MYSQL_ROOT_PASSWORD: tiger
29
+      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
30
+      MYSQL_DATABASE: ${MYSQL_DATABASE}
31
+      MYSQL_USER: ${MYSQL_USER}
32
+      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
30 33
   phpmyadmin:
31 34
     image: phpmyadmin/phpmyadmin
32 35
     container_name: 'sc-phpmyadmin'
@@ -35,6 +38,11 @@ services:
35 38
     environment:
36 39
       PMA_HOST: mysql
37 40
       PMA_PORT: 3306
41
+      PMA_USER: ${MYSQL_USER}
42
+      PMA_PASSWORD: ${MYSQL_PASSWORD}
43
+      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
44
+      MYSQL_USER: ${MYSQL_USER}
45
+      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
38 46
     ports:
39 47
       - '8080:80'
40 48
     volumes: 
@@ -43,4 +51,4 @@ services:
43 51
     container_name: 'sc-redis'
44 52
     image: redis:latest
45 53
     ports:
46
-      - "6379:6379"
54
+      - "${HOST_MACHINE_REDIS_PORT}:6379"

+ 20
- 1
sample.env View File

@@ -3,4 +3,23 @@ VHOSTS_DIR=./config/vhosts
3 3
 APACHE_LOG_DIR=./logs/apache2
4 4
 PHP_INI=./config/php/php.ini
5 5
 MYSQL_DATA_DIR=./data/mysql
6
-MYSQL_LOG_DIR=./logs/mysql
6
+MYSQL_LOG_DIR=./logs/mysql
7
+
8
+# If you already has the port 80 in use, you can change it (for example if you have Apache)
9
+HOST_MACHINE_UNSECURE_HOST_PORT=80
10
+HOST_MACHINE_SECURE_HOST_PORT=443
11
+
12
+# If you already has the port 3306 in use, you can change it (for example if you have MySQL)
13
+HOST_MACHINE_MYSQL_PORT=3306
14
+
15
+# If you already has the port 6379 in use, you can change it (for example if you have Redis)
16
+HOST_MACHINE_REDIS_PORT=6379
17
+
18
+
19
+# MySQL root user password
20
+MYSQL_ROOT_PASSWORD=tiger
21
+
22
+# Database settings: Username, password and database name
23
+MYSQL_USER=docker
24
+MYSQL_PASSWORD=docker
25
+MYSQL_DATABASE=docker

Loading…
Cancel
Save