-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
40 lines (39 loc) · 975 Bytes
/
Copy pathdocker-compose.yml
File metadata and controls
40 lines (39 loc) · 975 Bytes
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
version: '3.7'
services:
app:
build: .
expose:
- ${APP_PORT}
ports:
- ${APP_PORT}:${APP_PORT}
env_file:
- .env
depends_on:
- app_db
environment:
- DB_HOST=app_db
app_db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: '${DB_DATABASE}'
# So you don't have to use root, but you can if you like
MYSQL_USER: '${DB_USERNAME}'
# You can use whatever password you like
MYSQL_PASSWORD: '${DB_PASSWORD}'
# Password for root access
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
# Allow Empty Password
MYSQL_ALLOW_EMPTY_PASSWORD: ${DB_ALLOW_EMPTY_PASSWORD}
ports:
# <Port exposed> : < MySQL Port running inside container>
- '${DB_PORT}:3306'
expose:
# Opens port 3306 on the container
- '${DB_PORT}'
# Where our data will be persisted
volumes:
- db_data:/var/lib/mysql
# Names our volume
volumes:
db_data: