-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
49 lines (47 loc) · 1.05 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
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- '3001:3001'
environment:
- NODE_ENV=production
- DB_HOST=mysql
- DB_USER=myuser
- DB_PASSWORD=mypassword
- DB_DATABASE=myappdb
# env_file:
# - .env
depends_on:
- mysql
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- '3000:80'
depends_on:
- backend
mysql:
image: mysql:8.0
ports:
- '3306:3306'
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: myappdb
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
# init.sql only executed if the MySQL container is started with an empty data directory
volumes:
- mysql-data:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
command: --default-authentication-plugin=mysql_native_password
restart: always
volumes:
mysql-data:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: './mysql-data'