-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
44 lines (41 loc) · 1.29 KB
/
docker-compose.yml
File metadata and controls
44 lines (41 loc) · 1.29 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
version: "3.9"
services:
db:
image: postgres:16-alpine
container_name: fundable_db
restart: unless-stopped
environment:
POSTGRES_USER: ${DATABASE_USERNAME:-postgres}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-postgres}
POSTGRES_DB: ${DATABASE_NAME:-fundable_db}
ports:
- "${DATABASE_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DATABASE_USERNAME:-postgres} -d ${DATABASE_NAME:-fundable_db}"]
interval: 5s
timeout: 5s
retries: 5
migrate:
image: node:20-alpine
container_name: fundable_migrate
working_dir: /app
environment:
NODE_ENV: ${NODE_ENV:-local_dev}
DATABASE_HOST: db # uses service name, not localhost
DATABASE_PORT: ${DATABASE_PORT:-5432}
DATABASE_NAME: ${DATABASE_NAME:-fundable_db}
DATABASE_USERNAME: ${DATABASE_USERNAME:-postgres}
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-postgres}
volumes:
- .:/app
- /app/node_modules # prevents host node_modules from leaking in
depends_on:
db:
condition: service_healthy
command: sh -c "npm install && npx typeorm migration:run -d src/config/persistence"
profiles:
- migrate
volumes:
postgres_data: