-
Notifications
You must be signed in to change notification settings - Fork 8
/
docker-compose.yml
106 lines (100 loc) · 3.41 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
version: '3.8'
services:
Yii2Oauth2Server:
build:
context: .
dockerfile: docker/Yii2Oauth2Server/Dockerfile
image: "rhertogh/yii2-oauth2-server"
networks:
- dev
depends_on:
MySQL:
condition: service_healthy
PostgreSQL:
condition: service_healthy
ports:
- '${DOCKER_HOST_HTTP_PORT:-80}:80' # http port mapping
volumes:
# Re-use local composer cache via host-volume
- ~/.composer-docker/cache:/root/.composer/cache:delegated
# Mount source-code for development
- .:/app
# Mount for SQLite database
- ${DOCKER_HOST_SQLITE_DB_DIR:-SQLite}:/var/sqlite # Mounting location should be kept in sync with the default value for the `SQLITE_DB_FILE` environment variable.
environment:
# Yii2
- YII_ENV=${YII_ENV:-dev}
- YII_DB_DRIVER=${YII_DB_DRIVER:-MySQL} # Note: Defaults to MySQL, the stand-alone Docker image defaults to SQLite
# PHP & Xdebug
- PHP_IDE_CONFIG=${PHP_IDE_CONFIG:-serverName=Yii2Oauth2Server}
- PHP_ENABLE_XDEBUG=${PHP_ENABLE_XDEBUG:-1}
- XDEBUG_MODE=${XDEBUG_MODE}
- XDEBUG_CONFIG=${XDEBUG_CONFIG}
# Oauth2 Server
- YII2_OAUTH2_SERVER_PRIVATE_KEY_PASSPHRASE=${YII2_OAUTH2_SERVER_PRIVATE_KEY_PASSPHRASE:?err}
- YII2_OAUTH2_SERVER_CODES_ENCRYPTION_KEY=${YII2_OAUTH2_SERVER_CODES_ENCRYPTION_KEY:?err}
- YII2_OAUTH2_SERVER_STORAGE_ENCRYPTION_KEYS=${YII2_OAUTH2_SERVER_STORAGE_ENCRYPTION_KEYS:?err}
# MySQL
- MYSQL_HOST=${MYSQL_HOST:-mysql}
- MYSQL_PORT=${MYSQL_PORT}
- MYSQL_DB_NAME=${MYSQL_DB_NAME:?err}
- MYSQL_USER_NAME=${MYSQL_USER_NAME:?err}
- MYSQL_USER_PASSWORD=${MYSQL_USER_PASSWORD:?err}
# PostgreSQL
- POSTGRES_HOST=${POSTGRES_HOST:-postgresql}
- POSTGRES_USER=${POSTGRES_USER:?err}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?err}
- POSTGRES_DB=${POSTGRES_DB:?err}
# SQLite
- SQLITE_DB_FILE=${SQLITE_DB_FILE:-/var/sqlite/Yii2-Oauth2-Server.sqlite} # Default value should be kept in sync with the SQLite volume mounting
extra_hosts:
- host.docker.internal:host-gateway
MySQL:
image: "mysql:5.7"
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:?err}
- MYSQL_ROOT_HOST=%
- MYSQL_DATABASE=${MYSQL_DB_NAME:?err}
- MYSQL_USER=${MYSQL_USER_NAME:?err}
- MYSQL_PASSWORD=${MYSQL_USER_PASSWORD:?err}
networks:
- dev
volumes:
- MySql:/var/lib/mysql
ports:
- "${DOCKER_HOST_MYSQL_PORT:-3306}:3306" # mysql port mapping
healthcheck:
test: mysqladmin ping -h localhost -u root -p$${MYSQL_ROOT_PASSWORD} || exit 1
start_period: 10s
start_interval: 1s
interval: 60s
timeout: 3s
retries: 3
PostgreSQL:
image: "postgres:14-alpine"
restart: always
environment:
- POSTGRES_USER=${POSTGRES_USER:?err}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?err}
- POSTGRES_DB=${POSTGRES_DB:?err}
networks:
- dev
volumes:
- Postgres:/var/lib/postgresql/data
ports:
- "${DOCKER_HOST_POSTGRES_PORT:-5432}:5432" # Postgres port mapping, it's recommended to use a different port than the default sample app.
healthcheck:
test: pg_isready || exit 1
start_period: 10s
start_interval: 1s
interval: 60s
timeout: 3s
retries: 3
networks:
dev:
driver: bridge
name: dev
volumes:
MySql:
Postgres:
SQLite: