forked from khs1994-docker/lnmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-lnmp.yml
204 lines (194 loc) · 6.43 KB
/
docker-lnmp.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
version: "3.7"
#
# @link https://docs.docker.com/compose/overview/
# @link https://docs.docker.com/compose/compose-file/#extension-fields
# @link https://github.com/docker-library/docs
#
x-common:
&default-common
restart: ${LNMP_RESTART:-always}
env_file: ./cli/timezone.env
networks:
- backend
read_only: ${LNMP_ROOT_FILESYSTEM_READ_ONLY:-false}
# dns:
# - ${DNS:-114.114.114.114}
services:
mysql:
<< : *default-common
image: "${LNMP_BUILD_DOCKER_IMAGE_PREFIX:-khs1994}/mysql:${LNMP_MYSQL_VERSION:-8.0.19}"
environment:
# @link https://github.com/docker-library/docs/tree/master/mysql#environment-variables
# @link https://dev.mysql.com/doc/refman/8.0/en/environment-variables.html
# MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_root_password
MYSQL_ROOT_PASSWORD: ${LNMP_MYSQL_ROOT_PASSWORD:-mytest}
MYSQL_DATABASE: ${LNMP_MYSQL_DATABASE:-test}
# MYSQL_USER:
# MYSQL_PASSWORD:
ports:
- "${LNMP_MYSQL_PORT:-127.0.0.1:3306}:3306"
- "${LNMP_MYSQL_PORT_X:-127.0.0.1:33060}:33060"
volumes:
- ./config/mysql/${LNMP_MYSQL_CONF:-docker.cnf}:/etc/mysql/conf.d/docker.cnf:ro,cached
# @link https://github.com/docker-library/docs/tree/master/mysql#initializing-a-fresh-instance
- ./scripts/backup/init:/docker-entrypoint-initdb.d:ro,cached
- type: volume
source: mysql-data
target: ${LNMP_MYSQL_DATA:-/var/lib/mysql}
- ./log/mysql:/var/log/mysql:delegated
- ./scripts/backup/mysql:/backup
- type: tmpfs
target: /run
- type: tmpfs
target: /run/mysqld
command:
- mysqld
- --character-set-server=utf8mb4
- --default-authentication-plugin=mysql_native_password
# secrets:
# - db_root_password
redis:
<< : *default-common
image: "${LNMP_BUILD_DOCKER_IMAGE_PREFIX:-khs1994}/redis:${LNMP_REDIS_VERSION:-5.0.7}-alpine"
ports:
- "${LNMP_REDIS_PORT:-127.0.0.1:6379}:6379"
volumes:
- ./config/redis/${LNMP_REDIS_CONF:-redis.conf}:/redis.conf:ro,cached
# - redis-data:/data:cached
- type: volume
source: redis-data
target: /data
volume:
nocopy: true
- ./log/redis:/var/log/redis:delegated
- type: tmpfs
target: /run
# set config by command
command: [
"redis-server",
"/redis.conf",
"--daemonize no",
"--logfile /var/log/redis/redis.log",
"--bind 0.0.0.0",
"--appendonly yes",
# "--save \"\"",
"--aof-use-rdb-preamble yes"
]
healthcheck:
test: ["CMD","redis-cli","ping"]
memcached:
<< : *default-common
image: ${LNMP_BUILD_DOCKER_IMAGE_PREFIX:-khs1994}/memcached:${LNMP_MEMCACHED_VERSION:-1.5.22}-alpine
ports:
- "${LNMP_MEMCACHED_PORT:-127.0.0.1:11211}:11211"
volumes:
- type: volume
source: zoneinfo-data
target: /usr/share/zoneinfo
volume:
nocopy: true
- type: tmpfs
target: /run
php7:
&php7
<< : *default-common
image: "${LNMP_BUILD_DOCKER_IMAGE_PREFIX:-khs1994}/php:${LNMP_PHP_VERSION:-7.4.3}-fpm-alpine"
# container_name: khs1994-docker-lnmp-php-fpm
volumes:
- ${APP_ROOT:-./app}:${LNMP_PHP_PATH:-/app}:cached
# fpm config
- ./config/php/${LNMP_PHP_FPM_CONF:-zz-docker.conf}:/usr/local/etc/php-fpm.d/zz-docker.conf:ro,cached
# php.ini
- ./config/php/${LNMP_PHP_INI:-php.development.ini}:/usr/local/etc/php/php.ini:ro,cached
# php.ini override
- ./config/php/${LNMP_PHP_EXTRA_INI:-docker-php.ini}:/usr/local/etc/php/conf.d/docker-php.ini:ro,cached
# log,etc
- ./log/php:/var/log/php:delegated
- ./log/supervisord.log:/var/log/supervisord.log:delegated
- ./log/supervisord:/var/log/supervisord:delegated
- type: volume
source: zoneinfo-data
target: /usr/share/zoneinfo
volume:
nocopy: false
- type: tmpfs
target: /run
# tmpfs:
# size: 1000
networks:
- frontend
- backend
expose:
- "9000"
command: php-fpm -R -F
# command: php-fpm -F
environment:
- LNMP_DOCKER_VERSION=${LNMP_DOCKER_VERSION:-v19.03} x86_64 With Pull Docker Image
- APP_ENV=development
- LNMP_XDEBUG_REMOTE_HOST=${LNMP_XDEBUG_REMOTE_HOST:-192.168.199.100}
- LNMP_XDEBUG_REMOTE_PORT=${LNMP_XDEBUG_REMOTE_PORT:-9001}
- LNMP_OPCACHE_ENABLE=${LNMP_OPCACHE_ENABLE:-1}
composer:
<< : *default-common
restart: "no"
image: "${LNMP_BUILD_DOCKER_IMAGE_PREFIX:-khs1994}/php:${LNMP_PHP_VERSION:-7.4.3}-composer-alpine"
volumes:
- ${APP_ROOT:-./app}:${LNMP_PHP_PATH:-/app}:cached
- type: volume
source: composer_cache-data
target: /tmp/cache
- ./config/composer/config.json:/tmp/config.json:delegated
# https://docs.docker.com/config/containers/multi-service_container/
# http://supervisord.org/running.html
supervisord:
<< : *php7
networks:
- backend
image: "${LNMP_BUILD_DOCKER_IMAGE_PREFIX:-khs1994}/php:${LNMP_PHP_VERSION:-7.4.3}-supervisord-alpine"
secrets:
- source: supervisord_ini
target: /etc/supervisor.d/supervisord.ini
command: ["/usr/bin/supervisord","-n"]
expose:
- "9001"
phpmyadmin:
<< : *default-common
image: ${LNMP_BUILD_DOCKER_IMAGE_PREFIX:-khs1994}/phpmyadmin:${LNMP_PHPMYADMIN_VERSION:-latest}
environment:
- PMA_HOST=mysql
ports:
- ${LNMP_PHPMYADMIN_PORT:-127.0.0.1:8080}:80
volumes:
- type: volume
source: phpmyadmin-data
target: /sessions
- type: tmpfs
target: /run
networks:
- backend
- frontend
healthcheck:
test: ["CMD","curl","-sf","127.0.0.1:80"]
nginx:
<< : *default-common
image: "${LNMP_BUILD_DOCKER_IMAGE_PREFIX:-khs1994}/nginx:${LNMP_NGINX_VERSION:-1.17.8}-alpine"
ports:
- "${LNMP_NGINX_HTTPS_PORT:-0.0.0.0:443}:443"
- "${LNMP_NGINX_HTTP_PORT:-0.0.0.0:80}:80"
volumes:
# - ./config/nginx:/etc/nginx/conf.d:ro,cached
- type: bind
source: ./config/${LNMP_NGINX_CONF_D:-nginx}
target: /etc/nginx/conf.d
- ${APP_ROOT:-./app}:${LNMP_PHP_PATH:-/app}:cached
- ./config/etc/nginx/${LNMP_NGINX_CONF:-nginx.conf}:/etc/nginx/nginx.conf:ro,cached
- ./log/nginx:/var/log/nginx:delegated
- type: tmpfs
target: /run
working_dir: /app
networks:
- frontend
depends_on:
- php7
healthcheck:
test: ["CMD","nginx","-t"]