-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
131 lines (122 loc) · 4.66 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
########################################################################################################################
## Docker Compose file for Local and CI
##
## This creates a local development environment. It can also be used for your CI work.
##
## Important things to note:
## - PHP-FPM has a debug version with xdebug loaded. This is useful for regular development (so you can use xdebug)
## and for code coverage. This is slower though, so we don't use the debug container for normal test runs.
## - The `alpine` variants of each container are preferred because of their smaller size.
## - All containers use the `COMPOSE_PROJECT_NAME` environment variable as a prefix. We set an explicit name to avoid
## Docker adding a numeric suffix like `-1`. Local dev will never have multiple instances of a container, so setting
## an explicit name makes the `docker/bin` scripts more straightforward. Volumes and networks will also be pre-fixed
## automatically.
## - Make sure to enable the performance optimization for Macs, if you're running on macOS 12.2 or higher.
## From Docker Desktop, go to Settings, Experimental Features and enable both settings for virtualization and VirtioFS.
########################################################################################################################
services:
## The App database
mysql:
container_name: "${COMPOSE_PROJECT_NAME}-mysql"
image: mysql:8.0.37
volumes:
- mysql-data:/var/lib/mysql
- ./docker/mysql/init:/docker-entrypoint-initdb.d
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: app # update .env and .env.example if you change any of these values
MYSQL_USER: app
MYSQL_PASSWORD: app
# Uncomment the command section if you need to deviate from MySQL defaults (like on a legacy database schema)
# command:
# - "--character-set-server=utf8mb4"
# - "--collation-server=utf8mb4_0900_ai_ci"
# - "--default-authentication-plugin=caching_sha2_password"
restart: unless-stopped
## MySQL just for Unit Tests
mysql-test:
container_name: "${COMPOSE_PROJECT_NAME}-mysql-test"
image: mysql:8.0.37
volumes:
- mysql-test-data:/var/lib/mysql
- ./docker/mysql/init:/docker-entrypoint-initdb.d
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: apptest # update phpunit.xml if you change any of these values
MYSQL_USER: app
MYSQL_PASSWORD: app
# Uncomment the command section if you need to deviate from MySQL defaults (like on a legacy database schema)
# command:
# - "--character-set-server=utf8mb4"
# - "--collation-server=utf8mb4_0900_ai_ci"
# - "--default-authentication-plugin=caching_sha2_password"
restart: unless-stopped
redis:
container_name: "${COMPOSE_PROJECT_NAME}-redis"
image: redis:7.2.5-alpine3.20
restart: unless-stopped
## NGINX to support the app, configured to use the php-fpm-debug server
nginx:
container_name: "${COMPOSE_PROJECT_NAME}-nginx"
build:
context: docker/nginx
tags: # required for Docker buildx/bake to tag properly
- "${COMPOSE_PROJECT_NAME}-nginx"
working_dir: /app
volumes:
- .:/app
labels:
- "dev.orbstack.domains=${DOCKER_SERVER_NAME}"
depends_on:
- php-fpm-debug
restart: unless-stopped
## The PHP-FPM that's used for the app development, also useful for code coverage
php-fpm-debug:
container_name: "${COMPOSE_PROJECT_NAME}-php-fpm-debug"
build:
context: docker/php-fpm
tags: # required for Docker buildx/bake to tag properly
- "${COMPOSE_PROJECT_NAME}-php-fpm-debug"
working_dir: /app
volumes:
- .:/app
depends_on:
- mysql
environment:
PHP_IDE_CONFIG: "serverName=${DOCKER_SERVER_NAME}"
restart: unless-stopped
## The PHP-FPM that's used for unit tests and could possibly be used for production instances
php-fpm:
container_name: "${COMPOSE_PROJECT_NAME}-php-fpm"
build:
context: docker/php-fpm
target: base
tags: # required for Docker buildx/bake to tag properly
- "${COMPOSE_PROJECT_NAME}-php-fpm"
working_dir: /app
volumes:
- .:/app
depends_on:
- mysql
environment:
PHP_IDE_CONFIG: "serverName=${DOCKER_SERVER_NAME}"
restart: unless-stopped
## The Horizon worker to process queue jobs
horizon:
container_name: "${COMPOSE_PROJECT_NAME}-horizon"
build:
context: docker/php-fpm
target: base
working_dir: /app
entrypoint: php artisan horizon
volumes:
- .:/app
depends_on:
- mysql
- redis
restart: unless-stopped
volumes:
mysql-data:
mysql-test-data:
networks:
default: