-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
63 lines (61 loc) · 1.86 KB
/
docker-compose.yml
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
version: '3'
services:
# The nginx service
web:
# Use the latest Nginx image from Docker Hub
image: nginx:latest
# Map host port 8080 to container port 80
ports:
- "8080:80"
# Mount the DOC_ROOT folder on the host to /var/www/html in the container
# Mount the nginx configuration folder on the host to /etc/nginx/conf.d in the container
volumes:
- ./public:/var/www/html
- ./nginx-conf:/etc/nginx/conf.d
# Link this service to the 'php' service
links:
- php
# Connect this service to the 'app-network'
networks:
- app-network
# The PHP service
php:
# Specifies that we want to build an image for this service
build:
# The build context, which is the current directory
context: .
# The Dockerfile to use for building the image
dockerfile: Dockerfile.php
# Mount the DOC_ROOT folder on the host to /var/www/html in the container
volumes:
- ./config/php:/usr/local/etc/php/conf.d
- ./public:/var/www/html
# Connect this service to the 'app-network'
networks:
- app-network
# The MySQL service
db:
# Use the latest MySQL image from Docker Hub
image: mysql:latest
# Restart the container if it exits with an error
restart: always
# Set environment variables for MySQL
environment:
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE: docker_test_db
MYSQL_USER: docker_user
MYSQL_PASSWORD: dockerpass
MYSQL_ALLOW_EMPTY_PASSWORD: true
# Map host port 3306 to container port 3306
ports:
- "3306:3306"
# Mount the MySQL data folder on the host to /var/lib/mysql in the container
volumes:
- ./mysql:/var/lib/mysql
# Connect this service to the 'app-network'
networks:
- app-network
# Create a new Docker network named 'app-network'
networks:
app-network:
driver: bridge