-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
80 lines (75 loc) · 2.03 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
# docker-compose --env-file .env.local up
networks:
devnetwork:
services:
frontend:
build:
context: .
dockerfile: frontend/Dockerfile
environment:
- CHROME_BIN=/usr/bin/chromium
volumes:
# The following works but shouldn't be necessary:
# - /Users/davidsilva/Dev/interview-prep/frontend:/app/frontend
- ${HOST_PROJECT_PATH}/frontend:/app/frontend
# The following *should* work, but it doesn't:
# - ./frontend:/app/frontend
- /app/frontend/node_modules
image: interview-prep-frontend:latest
ports:
- "4200:4200"
working_dir: /app/frontend
command: npm run start
depends_on:
- backend
networks:
- devnetwork
backend:
build:
context: ./backend
dockerfile: Dockerfile
image: interview-prep-backend:latest
ports:
- "3000:3000"
environment:
- DATABASE_URL=${DATABASE_URL}
- NODE_ENV=${NODE_ENV}
volumes:
# The following works but shouldn't be necessary:
# - /Users/davidsilva/Dev/interview-prep/backend:/app/backend
- ${HOST_PROJECT_PATH}/backend:/app/backend
# The following *should* work, but it doesn't:
# - ./backend:/app/backend
- /app/backend/node_modules
command: npm run dev
depends_on:
- db
networks:
- devnetwork
db:
image: postgres:latest
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
ports:
- "5432:5432"
volumes:
- postgres-dev-data:/var/lib/postgresql/data # Persist data even after container is removed
networks:
- devnetwork
migrate:
build:
context: ./backend
dockerfile: Dockerfile
working_dir: /app/backend
environment:
- NODE_ENV=${NODE_ENV}
- DATABASE_URL=${DATABASE_URL}
command: sh -c "npm install && npx knex migrate:latest --knexfile=./src/knexFile.ts --env $NODE_ENV"
depends_on:
- db
networks:
- devnetwork
volumes:
postgres-dev-data: