Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
59 lines (56 loc) · 1.77 KB
/
Copy pathdocker-compose.yml
File metadata and controls
59 lines (56 loc) · 1.77 KB
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
services:
app:
build:
context: .
dockerfile: resources/docker/Dockerfile
args:
PHP_VERSION: ${PHP_VERSION:-8.4}
PHALCON_VARIANT: ${PHALCON_VARIANT:-v5}
UID: ${UID:-1000}
GID: ${GID:-1000}
container_name: ${PROJECT_PREFIX:-rest-api}-app
hostname: ${PROJECT_PREFIX:-rest-api}-app
volumes:
- .:/srv
env_file: .env
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
nginx:
image: nginx:alpine
container_name: ${PROJECT_PREFIX:-rest-api}-nginx
hostname: ${PROJECT_PREFIX:-rest-api}-nginx
ports:
# Host port is configurable (APP_PORT) so multiple apps can coexist;
# the container always listens on 80.
- "${APP_PORT:-8080}:80"
volumes:
- .:/srv
- ./resources/docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- app
mysql:
image: mysql:8.0
container_name: ${PROJECT_PREFIX:-rest-api}-mysql
environment:
MYSQL_ROOT_PASSWORD: ${DATA_API_MYSQL_PASS:-secret}
MYSQL_DATABASE: ${DATA_API_MYSQL_NAME:-phalcon_api}
# No host port published: the app reaches the DB over the internal compose
# network as mysql:3306. Not exposed to the host by design.
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-p${DATA_API_MYSQL_PASS:-secret}"]
interval: 5s
timeout: 5s
retries: 12
redis:
image: redis:alpine
container_name: ${PROJECT_PREFIX:-rest-api}-redis
# No host port published: the app reaches the cache over the internal
# compose network as redis:6379. Not exposed to the host by design.
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 12