-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
39 lines (37 loc) · 908 Bytes
/
docker-compose.yml
File metadata and controls
39 lines (37 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
version: "3.7"
services:
database:
image: mysql:5
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: scotchbox
ports:
- "127.0.0.1:3306:3306"
networks:
- database
webserver:
image: php:apache
depends_on: ['database']
environment:
MYSQL_HOST: database
command:
- /bin/sh
- -ec
- |-
# Install PHP extensions
docker-php-ext-install mysqli && docker-php-ext-enable mysqli
# Set database URL
sed -i -e 's/localhost/database/' /var/www/html/db/mysql_credentials.php
# Launch webserver
apache2-foreground
# Reset the file to default
sed -i -e 's/database/localhost/' /var/www/html/db/mysql_credentials.php
ports:
- "127.0.0.1:8080:80"
volumes:
- ./public:/var/www/html
networks:
- database
networks:
database:
driver: bridge