-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
88 lines (84 loc) · 2.22 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
# For development: docker compose --profile dev up --build
# For production: docker compose --profile prod up --build
version: "3"
services:
# Prod specific services
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.prod
args:
- REACT_APP_BACKEND_URL=${REACT_APP_BACKEND_URL:-http://localhost:3001}
ports:
- "80:80"
- "443:443"
restart: always
depends_on:
- backend
profiles:
- prod
backend:
build:
context: ./backend
dockerfile: Dockerfile.dev
ports:
- "3001:3001"
restart: always
environment:
- DB_HOST=${DB_HOST:-backend-db}
- DB_PORT=${DB_PORT:-3306}
- DB_USER=${DB_USER:-user}
- DB_PASSWORD=${DB_PASSWORD:-password}
- DB_DATABASE=${DB_DATABASE:-sample_data}
- NODE_ENV=${NODE_ENV:-development}
profiles:
- prod
# Dev specific services
frontend-dev:
build:
context: ./frontend
dockerfile: Dockerfile.dev
environment:
- REACT_APP_BACKEND_URL=${REACT_APP_BACKEND_URL:-http://localhost:3001}
- CHOKIDAR_USEPOLLING=true # For hot reloading
- WATCHPACK_POLLING=true # For hot reloading
- WDS_SOCKET_HOST=127.0.0.1 # For hot reloading
ports:
- "3000:3000"
depends_on:
- backend-dev
volumes:
- "./frontend:/app"
- "/app/node_modules"
profiles:
- dev
backend-dev:
build:
context: ./backend
dockerfile: Dockerfile.dev
ports:
- "3001:3001"
environment:
- DB_HOST=${DB_HOST:-backend-db}
- DB_PORT=${DB_PORT:-3306}
- DB_USER=${DB_USER:-user}
- DB_PASSWORD=${DB_PASSWORD:-password}
- DB_DATABASE=${DB_DATABASE:-sample_data}
depends_on:
- backend-db
profiles:
- dev
backend-db:
image: mysql:8.0
ports:
# Use port 9906 to avoid conflicts with a locally installed MySQL.
- "9906:3306"
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE:-sample_data}
- MYSQL_USER=${MYSQL_USER:-user}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-password}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-password}
volumes:
- ./sample_data.sql:/docker-entrypoint-initdb.d/sample_data.sql
profiles:
- dev