-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
docker-compose.yml
executable file
·116 lines (113 loc) · 2.97 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
110
111
112
113
114
115
116
version: "3.7"
networks:
db:
name: ${PROJECT_NAME}-network-db
# this is a YAML anchor to avoid repetition
# Any top-level key starting with x- in a Docker Compose file will be ignored
# replica with <<: *logging
x-logging: &logging
logging:
driver: json-file
services:
postgres:
image: postgres:${POSTGRES_VERSION}-alpine
container_name: ${PROJECT_NAME}-postgres
hostname: postgres
mem_limit: 300m
restart: always
<<: *logging
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_INITDB_ARGS: '--encoding=UTF-8'
LC_COLLATE: C
LC_CTYPE: C
LANG: C.UTF-8
TZ: ${TZ}
PGTZ: ${TZ}
expose:
- 5432
networks:
- db
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER}" ]
interval: 20s
timeout: 10s
retries: 7
mariadb:
container_name: ${PROJECT_NAME}-mariadb
hostname: mariadb
build:
context: ./
dockerfile: tools/docker/mariadb/build.Dockerfile
args:
- MARIA_VERSION=${MARIA_VERSION}
- DOCKER_ENV=${DOCKER_ENV}
- TZ=${TZ}
mem_limit: 250m
restart: always
<<: *logging
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
TZ: ${TZ}
expose:
- 3306
networks:
- db
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 20s
timeout: 10s
retries: 7
php:
container_name: ${PROJECT_NAME}-php
hostname: php
extra_hosts: # https://stackoverflow.com/a/43541681/2046442
- "host.docker.internal:host-gateway"
build:
context: ./
dockerfile: ./tools/docker/php-fpm/build.Dockerfile
args:
- PHP_VERSION=${PHP_VERSION}
- DOCKER_ENV=${DOCKER_ENV}
- APP_DIRECTORY=${APP_DIRECTORY}
- HOST_UID=${HOST_UID}
- HOST_GID=${HOST_GID}
- INSTALL_PHP_XDEBUG=${INSTALL_PHP_XDEBUG}
restart: always
<<: *logging
environment:
- TZ=${TZ}
- APP_DIRECTORY=${APP_DIRECTORY}
- DOCKER_ENV=${DOCKER_ENV}
- CI=${CI:-false}
- DB_CONNECTION=${DB_CONNECTION}
- MYSQL_DATABASE_URL=${MYSQL_DATABASE_URL}
- POSTGRES_DATABASE_URL=${POSTGRES_DATABASE_URL}
- VIRTUAL_HOST=${VIRTUAL_HOST}
- PHP_IDE_CONFIG=${PHP_IDE_CONFIG}
- XDEBUG_CONFIG=${XDEBUG_CONFIG}
- XDEBUG_MODE=${XDEBUG_MODE}
- COMPOSER_ALLOW_SUPERUSER=${COMPOSER_ALLOW_SUPERUSER}
volumes:
- ${PWD}:${MOUNT_APP_DIRECTORY}
- ../:/var/www/bundles
expose:
- "9000" # php-fpm
- "9003" # xdebug
depends_on:
mariadb:
condition: service_healthy
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "php-fpm", "-t"]
interval: 20s
timeout: 10s
retries: 7
networks:
db: