-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
40 lines (40 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
version: "3.7"
services:
db:
container_name: minimal-database
restart: unless-stopped
image: postgres
env_file:
- .env
environment:
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_USER: $POSTGRES_USER
POSTGRES_DB: $POSTGRES_DB
volumes:
- minimal-database-data:/var/lib/postgresql/data/ # persist data even if container shuts down
ports:
- "5432:5432"
backend:
container_name: minimal-backend
restart: unless-stopped
image: "node:14"
depends_on:
- db
ports:
- "80:5000"
user: "node" # for ubuntu, use root
working_dir: /home/node/app
volumes:
- ./:/home/node/app
command: >
sh -c "npm install && npm run db:migrate && npm run db:seed && npm start"
env_file:
- .env
environment:
#NODE_ENV: production
DATABASE_URL: "db"
DATABASE_PASSWORD: $POSTGRES_PASSWORD
DATABASE_USER: $POSTGRES_USER
DATABASE_NAME: $POSTGRES_DB
volumes:
minimal-database-data: # named volumes can be managed easier using docker-compose