Skip to content

Commit 91c0c68

Browse files
committed
Docker Changes
1. Upgraded docker-compose.yml to v 3.2 2. Added sample docker-compose.yml file for a 2nd test database 3. Added PHP configuration file (custom.ini) and added Zip module to PHP 4. Added client_max_body_size option to Nginx config.
1 parent fddecb4 commit 91c0c68

6 files changed

Lines changed: 142 additions & 27 deletions

File tree

docker-compose-testdb.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
version: "3.2"
2+
services:
3+
php:
4+
restart: unless-stopped
5+
tty: true
6+
build:
7+
context: ./docker/php
8+
environment:
9+
- DB_DRIVER=mysql
10+
- DB_HOST=ufmysql
11+
- DB_PORT=3306
12+
- DB_NAME=userfrosting
13+
- DB_USER=docker
14+
- DB_PASSWORD=secret
15+
- DB_TEST_DRIVER=mysql
16+
- DB_TEST_HOST=mysqltest
17+
- DB_TEST_PORT=3306
18+
- DB_TEST_NAME=userfrosting_test
19+
- DB_TEST_USER=docker
20+
- DB_TEST_PASSWORD=secret
21+
- TEST_DB=test_ufdb
22+
volumes:
23+
- .:/app
24+
- ./docker/php/custom.ini:/usr/local/etc/php/conf.d/custom.ini
25+
networks:
26+
- backend
27+
nginx:
28+
restart: unless-stopped
29+
tty: true
30+
ports:
31+
- "8591:80"
32+
- "8592:443"
33+
build:
34+
context: ./docker/nginx
35+
volumes:
36+
- .:/app
37+
depends_on:
38+
- php
39+
- ufmysql
40+
- ufmysqltest
41+
networks:
42+
- frontend
43+
- backend
44+
ufmysql:
45+
image: mysql:5.7
46+
networks:
47+
- backend
48+
environment:
49+
- MYSQL_DATABASE=userfrosting
50+
- MYSQL_ROOT_PASSWORD=secret
51+
- MYSQL_USER=docker
52+
- MYSQL_PASSWORD=secret
53+
ports:
54+
- 8593:3306
55+
volumes:
56+
- userfrosting-db:/var/lib/mysql
57+
ufmysqltest:
58+
image: mysql:5.7
59+
networks:
60+
- backend
61+
environment:
62+
- MYSQL_DATABASE=userfrosting_test
63+
- MYSQL_ROOT_PASSWORD=secret
64+
- MYSQL_USER=docker
65+
- MYSQL_PASSWORD=secret
66+
ports:
67+
- 8594:3306
68+
volumes:
69+
- userfrosting-test-db:/var/lib/mysql
70+
composer:
71+
image: "composer"
72+
volumes:
73+
- .:/app
74+
working_dir: /app
75+
command: -V
76+
node:
77+
image: node:alpine
78+
build:
79+
context: ./docker/node
80+
volumes:
81+
- .:/app
82+
working_dir: /app/build
83+
command: npm run uf-assets-install
84+
volumes:
85+
userfrosting-db:
86+
driver: local
87+
userfrosting-test-db:
88+
driver: local
89+
networks:
90+
frontend:
91+
backend:

docker-compose.yml

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,71 @@
1-
version: '2'
1+
version: "3.2"
22
services:
33
php:
4+
restart: unless-stopped
5+
tty: true
46
build:
57
context: ./docker/php
68
environment:
79
- DB_DRIVER=mysql
8-
- DB_HOST=mysql
10+
- DB_HOST=ufmysql
911
- DB_PORT=3306
1012
- DB_NAME=userfrosting
11-
- DB_USER=userfrosting
12-
- DB_PASSWORD=password
13+
- DB_USER=docker
14+
- DB_PASSWORD=secret
1315
volumes:
1416
- .:/app
15-
links:
16-
- mysql
17+
- ./docker/php/custom.ini:/usr/local/etc/php/conf.d/custom.ini
18+
networks:
19+
- backend
1720
nginx:
21+
restart: unless-stopped
22+
tty: true
23+
ports:
24+
- "8591:80"
25+
- "8592:443"
1826
build:
1927
context: ./docker/nginx
20-
ports:
21-
- 8570:80
2228
volumes:
2329
- .:/app
24-
links:
30+
depends_on:
2531
- php
26-
mysql:
32+
- ufmysql
33+
networks:
34+
- frontend
35+
- backend
36+
ufmysql:
2737
image: mysql:5.7
38+
networks:
39+
- backend
2840
environment:
2941
- MYSQL_DATABASE=userfrosting
30-
- MYSQL_ROOT_PASSWORD=root
31-
- MYSQL_USER=userfrosting
32-
- MYSQL_PASSWORD=password
42+
- MYSQL_ROOT_PASSWORD=secret
43+
- MYSQL_USER=docker
44+
- MYSQL_PASSWORD=secret
3345
ports:
34-
- 8571:3306
46+
- 8593:3306
3547
volumes:
3648
- userfrosting-db:/var/lib/mysql
37-
3849
composer:
39-
image: composer/composer
40-
volumes_from:
41-
- php
50+
image: "composer"
51+
volumes:
52+
- .:/app
4253
working_dir: /app
4354
command: -V
4455

4556
node:
4657
image: node:alpine
4758
build:
4859
context: ./docker/node
49-
volumes_from:
50-
- php
60+
volumes:
61+
- .:/app
5162
working_dir: /app/build
5263
command: npm run uf-assets-install
5364

5465
volumes:
5566
userfrosting-db:
67+
driver: local
5668

69+
networks:
70+
frontend:
71+
backend:

docker/nginx/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
FROM nginx:alpine
2-
COPY default.conf /etc/nginx/conf.d/default.conf
2+
RUN rm /etc/nginx/conf.d/default.conf
3+
COPY default.conf /etc/nginx/conf.d/default.conf

docker/nginx/default.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ server {
2525
index index.php;
2626
try_files $uri /index.php?$query_string;
2727
}
28+
client_max_body_size 100M;
2829
}

docker/php/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
FROM php:7.2-fpm
22
RUN apt-get update && apt-get install -y \
3-
libfreetype6-dev \
4-
libjpeg62-turbo-dev \
5-
libpng-dev \
3+
libfreetype6-dev \
4+
libjpeg62-turbo-dev \
5+
libpng-dev \
6+
zip \
67
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
78
&& docker-php-ext-install -j$(nproc) gd \
8-
&& docker-php-ext-install -j$(nproc) pdo pdo_mysql
9+
&& docker-php-ext-install -j$(nproc) pdo pdo_mysql \
10+
&& docker-php-ext-install -j$(nproc) zip
911
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
10-
11-
WORKDIR /app
12+
WORKDIR /app

docker/php/custom.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
file_uploads = On
2+
memory_limit = 64M
3+
upload_max_filesize = 64M
4+
post_max_size = 64M
5+
max_execution_time = 600
6+
memory_limit=512M

0 commit comments

Comments
 (0)