-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathdocker-compose.yml
92 lines (91 loc) · 2.13 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
services:
onboarding_backend:
image: onboarding/onboarding:v0
build: ./backend
volumes:
- ./backend:/app
- /app/node_modules
ports:
- "3000:3000"
depends_on:
- db
env_file:
- ./backend/.env
environment:
- NODE_ENV=${NODE_ENV}
- PORT=${PORT}
- JWT_SECRET=${JWT_SECRET}
- EMAIL=${EMAIL}
- EMAIL_PASSWORD=${EMAIL_PASSWORD}
- EMAIL_HOST=${EMAIL_HOST}
- EMAIL_PORT=${EMAIL_PORT}
- EMAIL_ENABLE=${EMAIL_ENABLE}
develop:
watch:
- action: sync
path: ./backend
target: /app
ignore:
- node_modules/
- .git/
- "*.log"
- coverage/
- dist/
command: >
bash -c "if [ "$NODE_ENV" = "production" ]; then
if ! npx sequelize-cli db:migrate; then
if ! npx sequelize-cli db:create; then
echo 'Database already exists';
fi
npx sequelize-cli db:migrate;
fi
fi;
if [ \"$$NODE_ENV\" = \"production\" ]; then
npm run prod;
elif [ \"$$NODE_ENV\" = \"staging\" ]; then
npm run staging;
else
npm run dev;
fi"
db:
image: postgres:latest
env_file:
- ./backend/.env
environment:
- POSTGRES_USER=${DEV_DB_USERNAME}
- POSTGRES_PASSWORD=${DEV_DB_PASSWORD}
- POSTGRES_DB=${DEV_DB_NAME}
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
frontend:
build: ./frontend
volumes:
- ./frontend:/app
- /app/node_modules
ports:
- "4173:4173"
develop:
watch:
- action: sync
path: ./frontend
target: /app
ignore:
- node_modules/
environment:
- NODE_ENV=${NODE_ENV:-development}
command: >
bash -c "
if [ \"$NODE_ENV\" = \"development\" ]; then
npm run dev;
elif [ \"$NODE_ENV\" != \"development\" ]; then
npm run build && npm run preview;
fi"
mailhog:
image: mailhog/mailhog
ports:
- "1025:1025"
- "8025:8025"
volumes:
pgdata: