Pascal PELISSIER 3 years ago
parent
commit
00c07fd058

+ 21
- 0
LICENSE View File

@@ -0,0 +1,21 @@
1
+MIT License
2
+
3
+Copyright (c) 2017 Narendra Vaghela
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in all
13
+copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+SOFTWARE.

+ 1
- 0
bin/mysql/Dockerfile View File

@@ -0,0 +1 @@
1
+FROM mysql:5.7

+ 46
- 0
bin/webserver/Dockerfile View File

@@ -0,0 +1,46 @@
1
+FROM php:7.1.20-apache
2
+
3
+RUN apt-get -y update --fix-missing
4
+RUN apt-get upgrade -y
5
+
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
11
+
12
+# Composer
13
+RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
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
44
+
45
+# Enable apache modules
46
+RUN a2enmod rewrite headers

+ 0
- 0
config/php/.gitkeep View File


+ 3
- 0
config/php/php.ini View File

@@ -0,0 +1,3 @@
1
+memory_limit = 128M
2
+post_max_size = 100M
3
+upload_max_filesize = 20M

+ 0
- 0
config/vhosts/.gitkeep View File


+ 8
- 0
config/vhosts/default.conf View File

@@ -0,0 +1,8 @@
1
+<VirtualHost *:80>
2
+    ServerAdmin webmaster@localhost
3
+    DocumentRoot "/var/www/html"
4
+    ServerName localhost
5
+	<Directory "/var/www/html/">
6
+		AllowOverride all
7
+	</Directory>
8
+</VirtualHost>

+ 0
- 0
data/.gitkeep View File


+ 0
- 0
data/mysql/.gitkeep View File


+ 44
- 0
docker-compose.yml View File

@@ -0,0 +1,44 @@
1
+version: "3"
2
+
3
+services:
4
+  webserver:
5
+    build: 
6
+      context: ./bin/webserver
7
+    container_name: 'png-webserver'
8
+    restart: 'always'
9
+    ports:
10
+      - "80:80"
11
+      - "443:443"
12
+    links: 
13
+      - mysql
14
+    volumes: 
15
+      - ${DOCUMENT_ROOT-./www}:/var/www/html
16
+      - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
17
+      - ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled
18
+      - ${LOG_DIR-./logs/apache2}:/var/log/apache2
19
+  mysql:
20
+    build: ./bin/mysql
21
+    container_name: 'png-mysql'
22
+    restart: 'always'
23
+    ports:
24
+      - "3306:3306"
25
+    volumes: 
26
+      - ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql
27
+      - ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql
28
+    environment:
29
+      MYSQL_ROOT_PASSWORD: tiger
30
+      MYSQL_DATABASE: png
31
+      MYSQL_USER: png
32
+      MYSQL_PASSWORD: png
33
+  phpmyadmin:
34
+    image: phpmyadmin/phpmyadmin
35
+    container_name: 'png-phpmyadmin'
36
+    links:
37
+      - mysql
38
+    environment:
39
+      PMA_HOST: mysql
40
+      PMA_PORT: 3306
41
+    ports:
42
+      - '8080:80'
43
+    volumes: 
44
+      - /sessions

+ 0
- 0
logs/.gitkeep View File


+ 0
- 0
logs/apache2/.gitkeep View File


+ 0
- 0
logs/mysql/.gitkeep View File


+ 6
- 0
sample.env View File

@@ -0,0 +1,6 @@
1
+DOCUMENT_ROOT=./www
2
+VHOSTS_DIR=./config/vhosts
3
+APACHE_LOG_DIR=./logs/apache2
4
+PHP_INI=./config/php/php.ini
5
+MYSQL_DATA_DIR=./data/mysql
6
+MYSQL_LOG_DIR=./logs/mysql

+ 1
- 0
www/assets/css/bulma.css.map
File diff suppressed because it is too large
View File


+ 1
- 0
www/assets/css/bulma.min.css
File diff suppressed because it is too large
View File


+ 65
- 0
www/index.php View File

@@ -0,0 +1,65 @@
1
+<!DOCTYPE html>
2
+<html>
3
+    <head>
4
+        <meta charset="utf-8">
5
+        <meta name="viewport" content="width=device-width, initial-scale=1">
6
+        <title>LAMP STACK</title>
7
+        <link rel="stylesheet" href="/assets/css/bulma.min.css">
8
+    </head>
9
+    <body>
10
+        <section class="hero is-medium is-info is-bold">
11
+            <div class="hero-body">
12
+                <div class="container has-text-centered">
13
+                    <h1 class="title">
14
+                        LAMP STACK
15
+                    </h1>
16
+                    <h2 class="subtitle">
17
+                        Your local development environment
18
+                    </h2>
19
+                </div>
20
+            </div>
21
+        </section>
22
+        <section class="section">
23
+            <div class="container">
24
+                <div class="columns">
25
+                    <div class="column">
26
+                        <h3 class="title is-3 has-text-centered">Environment</h3>
27
+                        <hr>
28
+                        <div class="content">
29
+                            <ul>
30
+                                <li><?= apache_get_version(); ?></li>
31
+                                <li>PHP <?= phpversion(); ?></li>
32
+                                <li>
33
+                                    <?php
34
+                                    $link = mysqli_connect("mysql", "root", "tiger", null);
35
+
36
+/* check connection */
37
+                                    if (mysqli_connect_errno()) {
38
+                                        printf("MySQL connecttion failed: %s", mysqli_connect_error());
39
+                                    } else {
40
+                                        /* print server version */
41
+                                        printf("MySQL Server %s", mysqli_get_server_info($link));
42
+                                    }
43
+                                    /* close connection */
44
+                                    mysqli_close($link);
45
+                                    ?>
46
+                                </li>
47
+                            </ul>
48
+                        </div>
49
+                    </div>
50
+                    <div class="column">
51
+                        <h3 class="title is-3 has-text-centered">Quick Links</h3>
52
+                        <hr>
53
+                        <div class="content">
54
+                            <ul>
55
+                                <li><a href="http://localhost/phpinfo.php">phpinfo()</a></li>
56
+                                <li><a href="http://localhost:8080">phpMyAdmin</a></li>
57
+                                <li><a href="http://localhost/test_db.php">Test DB Connection</a></li>
58
+                            </ul>
59
+                        </div>
60
+                    </div>
61
+                </div>
62
+            </div>
63
+        </section>
64
+    </body>
65
+</html>

+ 3
- 0
www/phpinfo.php View File

@@ -0,0 +1,3 @@
1
+<?php
2
+phpinfo();
3
+

+ 14
- 0
www/test_db.php View File

@@ -0,0 +1,14 @@
1
+<?php
2
+$link = mysqli_connect("mysql", "root", "tiger", null);
3
+
4
+if (!$link) {
5
+    echo "Error: Unable to connect to MySQL." . PHP_EOL;
6
+    echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
7
+    echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
8
+    exit;
9
+}
10
+
11
+echo "Success: A proper connection to MySQL was made! The docker database is great." . PHP_EOL;
12
+echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
13
+
14
+mysqli_close($link);

Loading…
Cancel
Save