Skip to content

Commit fa6924f

Browse files
HRaval2HRaval2
HRaval2
authored and
HRaval2
committed
Docker configuration for PHP projects
0 parents  commit fa6924f

7 files changed

+94
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"# Docker-Setup"

app.dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM php:7.3-fpm
2+
3+
RUN apt-get update && apt-get install -y git zip unzip
4+
RUN docker-php-ext-install mysqli pdo pdo_mysql
5+
6+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

docker-compose.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
version: '2'
2+
services:
3+
4+
# The Application
5+
app:
6+
build:
7+
context: ./
8+
dockerfile: app.dockerfile
9+
working_dir: /var/www
10+
volumes:
11+
- ./:/var/www
12+
- ./php.ini:/usr/local/etc/php/php.ini
13+
environment:
14+
- "DB_PORT=3306"
15+
- "DB_HOST=database"
16+
17+
# The Web Server
18+
web:
19+
build:
20+
context: ./
21+
dockerfile: web.dockerfile
22+
working_dir: /var/www
23+
volumes_from:
24+
- app
25+
ports:
26+
- 8080:80
27+
28+
# The Database
29+
database:
30+
image: mysql:5.7.28
31+
volumes:
32+
- dbdata:/var/lib/mysql
33+
environment:
34+
- "MYSQL_DATABASE=homestead"
35+
- "MYSQL_USER=homestead"
36+
- "MYSQL_PASSWORD=secret"
37+
- "MYSQL_ROOT_PASSWORD=secret"
38+
ports:
39+
- "33061:3306"
40+
41+
# phpmyadmin
42+
phpmyadmin:
43+
depends_on:
44+
- database
45+
image: phpmyadmin/phpmyadmin
46+
volumes:
47+
- ./phpmyadmin.ini:/usr/local/etc/php/php.ini
48+
restart: always
49+
ports:
50+
- '8081:80'
51+
environment:
52+
PMA_HOST: database
53+
MYSQL_ROOT_PASSWORD: secret
54+
55+
volumes:
56+
dbdata:

php.ini

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
memory_limit = 750M
2+
post_max_size = 750M
3+
upload_max_filesize = 1000M
4+
max_execution_time = 5000
5+
max_input_time = 3000

phpmyadmin.ini

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
memory_limit = 750M
2+
post_max_size = 750M
3+
upload_max_filesize = 1000M
4+
max_execution_time = 5000
5+
max_input_time = 3000

vhost.conf

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
server {
2+
listen 80;
3+
index index.php index.html;
4+
root /var/www/public;
5+
6+
location / {
7+
try_files $uri /index.php?$args;
8+
}
9+
10+
location ~ \.php$ {
11+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
12+
fastcgi_pass app:9000;
13+
fastcgi_index index.php;
14+
include fastcgi_params;
15+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
16+
fastcgi_param PATH_INFO $fastcgi_path_info;
17+
}
18+
}

web.dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM nginx:1.10
2+
3+
ADD vhost.conf /etc/nginx/conf.d/default.conf

0 commit comments

Comments
 (0)