Skip to content

Commit 1cb744d

Browse files
committed
chore: add docker-compose for local development
1 parent c546e2f commit 1cb744d

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

docker-compose.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
x-db-credentials: &db-credentials
2+
POSTGRES_USER: ${POSTGRES_USER:-postgres}
3+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
4+
POSTGRES_DB: ${POSTGRES_DB:-workflow_builder}
5+
6+
x-db-connection: &db-connection
7+
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@db:5432/${POSTGRES_DB:-workflow_builder}
8+
9+
x-app-common: &app-common
10+
ports:
11+
- "3000:3000"
12+
environment:
13+
<<: *db-connection
14+
depends_on:
15+
db:
16+
condition: service_healthy
17+
18+
services:
19+
db:
20+
image: postgres:16-alpine
21+
container_name: workflow-builder-db
22+
restart: unless-stopped
23+
environment:
24+
<<: *db-credentials
25+
ports:
26+
- "5432:5432"
27+
volumes:
28+
- postgres_data:/var/lib/postgresql/data
29+
healthcheck:
30+
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
31+
interval: 5s
32+
timeout: 5s
33+
retries: 5
34+
35+
app:
36+
<<: *app-common
37+
build:
38+
context: .
39+
dockerfile: Dockerfile
40+
container_name: workflow-builder-app
41+
restart: unless-stopped
42+
profiles:
43+
- prod
44+
45+
dev:
46+
<<: *app-common
47+
image: node:22-alpine
48+
container_name: workflow-builder-dev
49+
working_dir: /app
50+
profiles:
51+
- dev
52+
volumes:
53+
- .:/app
54+
- node_modules:/app/node_modules
55+
env_file:
56+
- .env
57+
environment:
58+
<<: *db-connection
59+
HOSTNAME: "0.0.0.0"
60+
command: sh -c "npm install -g pnpm && pnpm install && pnpm dev --hostname 0.0.0.0"
61+
62+
volumes:
63+
postgres_data:
64+
node_modules:

0 commit comments

Comments
 (0)