-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
47 lines (43 loc) · 1.1 KB
/
docker-compose.yml
File metadata and controls
47 lines (43 loc) · 1.1 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
version: "3.9"
services:
db:
image: postgres:16-alpine
container_name: contacts_pg
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: contacts_db
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 10
volumes:
- pgdata:/var/lib/postgresql/data
app:
build: .
container_name: contacts_api
depends_on:
db:
condition: service_healthy
environment:
NODE_ENV: production
PORT: 3000
# App JWT config (override as needed)
JWT_SECRET: your_jwt_secret_here
JWT_EXPIRES_IN: 24h
# Postgres connection via individual variables (used by db/sequelize.js)
PGHOST: db
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: contacts_db
# Alternatively, you can set a single DATABASE_URL instead of the PG* vars:
# DATABASE_URL: postgres://postgres:postgres@db:5432/contacts_db
ports:
- "3000:3000"
restart: unless-stopped
volumes:
pgdata: