This repository has been archived by the owner on Jan 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
109 lines (103 loc) · 3.04 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Version of the Compose file format
# Version 3 is the most current and recommended one
version: "3"
# Top building block that defines
# All containers used for this service
services:
# Container 1
# https://hub.docker.com/_/mysql
db:
# Image name (optimally version)
# https://docs.docker.com/compose/compose-file/#image
image: mysql:5.7
# Define restart policy
# https://docs.docker.com/compose/compose-file/#restart
restart: on-failure
# Volumes definition
# Named volume, allows persisted data but without caring where locally it is stored
# https://nickjanetakis.com/blog/docker-tip-28-named-volumes-vs-path-based-volumes
volumes:
- db_data:/var/lib/mysql
# Add environment variables
# https://docs.docker.com/compose/compose-file/#environment
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
# List of networks to join
networks:
- wp
# Container 2
# https://hub.docker.com/_/wordpress
wordpress:
# List of dependencies
depends_on:
- db
# Image wordpress:latest but use Dockerfile to fix permission issue
build:
context: .
dockerfile: Dockerfile
image: wdd/wordpress
# Define restart policy
# https://docs.docker.com/compose/compose-file/#restart
restart: on-failure
# Volumes definition
# https://docs.docker.com/compose/compose-file/#volumes
volumes:
# PHP configuration
- ./wdd/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
# Maps your local folder, to path in a container
# Useful for file edits
- ./:/var/www/html
# Add environment variables
# https://docs.docker.com/compose/compose-file/#environment
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
# www (1000) is created in Dockerfile
APACHE_RUN_USER: www
APACHE_RUN_GROUP: www
# Ports mapping
ports:
- 80:80
- 443:443
# List of networks to join
networks:
- wp
# Container 3
# https://hub.docker.com/r/phpmyadmin/phpmyadmin
# This one is optional
phpmyadmin:
# List of dependencies
depends_on:
- db
# Image name (optimally version)
# https://docs.docker.com/compose/compose-file/#image
image: phpmyadmin/phpmyadmin
# Define restart policy
# https://docs.docker.com/compose/compose-file/#restart
restart: on-failure
# Ports mapping
ports:
- 8080:80
# Add environment variables
# https://docs.docker.com/compose/compose-file/#environment
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: password
volumes:
# Apply PHP configuration for PHPMyAdmin
- ./wdd/uploads.ini:/usr/local/etc/php/conf.d/php-phpmyadmin.ini
# List of networks to join
networks:
- wp
# Top building block that defines
# All networks used for this service
networks:
wp:
# Top building block that defines
# All volumes used for this service
volumes:
db_data: