-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
106 lines (102 loc) · 2.23 KB
/
Copy pathdocker-compose.yml
File metadata and controls
106 lines (102 loc) · 2.23 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
services:
db:
image: postgres:16-alpine
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
retries: 5
networks:
- shapeshift-network
restart: unless-stopped
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
memory: 256m
cpus: '0.5'
reservations:
memory: 128m
cpus: '0.25'
migrate:
build:
context: .
dockerfile: Dockerfile
env_file:
- .env
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
command: sh -c "pnpm db:generate && pnpm db:migrate && node dist/index.js"
depends_on:
db:
condition: service_healthy
networks:
- shapeshift-network
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
profiles:
- migrate
bot:
build:
context: .
dockerfile: Dockerfile
env_file:
- .env
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
NODE_ENV: production
volumes:
- bot-logs:/app/logs
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "node", "-e", "process.exit(0)"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- shapeshift-network
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
restart: always
profiles:
- production
deploy:
replicas: 1
resources:
limits:
memory: 512m
cpus: '1.0'
reservations:
memory: 256m
cpus: '0.5'
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
networks:
shapeshift-network:
driver: bridge
volumes:
pgdata:
bot-logs: