-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_compose.yml
More file actions
90 lines (86 loc) · 2.41 KB
/
docker_compose.yml
File metadata and controls
90 lines (86 loc) · 2.41 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
services:
db:
image: postgres:17.6-alpine3.22
container_name: horm-db
environment:
POSTGRES_USER: 'admin'
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
# Expose Postgres to the host for local tools (optional)
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 15
networks:
- horm_network
redis:
image: redis:8.2-rc1-alpine
container_name: horm-redis
# If you want a password, set REDIS_PASSWORD in .env; otherwise leave it empty
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
command: >
sh -c '
if [ -n "$REDIS_PASSWORD" ]; then
exec redis-server --appendonly yes --requirepass "$REDIS_PASSWORD";
else
exec redis-server --appendonly yes;
fi
'
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis-data:/data
healthcheck:
test: [ "CMD-SHELL", "redis-cli -a \"$REDIS_PASSWORD\" ping | grep PONG || redis-cli ping | grep PONG" ]
interval: 5s
timeout: 5s
retries: 15
networks:
- horm_network
app:
build:
context: .
dockerfile: Dockerfile
container_name: horm-app
env_file:
- .env
environment:
# Compose expands these at runtime using values from .env
NODE_ENV: production
PORT: 9988
REDIS_URL: 'redis://redis:6379'
POSTGRES_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT}
SMTP_USER: ${SMTP_USER}
SMTP_PASS: ${SMTP_PASS}
SMTP_FROM: ${SMTP_FROM}
SMTP_SECURE: ${SMTP_SECURE}
NOTIFY_EMAIL: ${NOTIFY_EMAIL}
NOTIFY_WEBHOOK: ${NOTIFY_WEBHOOK}
NOTIFY_CHANNELS: ${NOTIFY_CHANNELS}
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
ports:
# Host:Container
- "${PORT:-9988}:9988"
restart: unless-stopped
networks:
- horm_network
# If you have migrations, uncomment the next lines and ensure the scripts exist in package.json:
# command: sh -c "bun run db:migrate && bun run start"
volumes:
postgres-data:
redis-data:
networks:
horm_network:
driver: bridge