-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
129 lines (119 loc) · 3.97 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
129 lines (119 loc) · 3.97 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: freenary
x-app-build: &app-build
context: .
dockerfile: .docker/dockerfile.dev
x-app-watch: &app-watch
- action: sync
path: ./apps
target: /app/apps
ignore:
- node_modules/
# Generated on each side by the paraglide compile step: syncing the host
# copy over the container's deletes it mid-session, and Vite caches the
# failed resolution of `@/paraglide/server.js` into a permanent 500.
- web/src/paraglide/
- action: sync
path: ./packages
target: /app/packages
ignore:
- node_modules/
- action: rebuild
path: ./bun.lock
# The root .env file is optional, and every variable a contributor sets in it
# reaches the containers through it. Only the values this stack derives from the
# worktree identity are listed below, and `environment` wins over `env_file`.
x-app-env-file: &app-env-file
- path: .env
required: false
x-app-env: &app-env
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD:-password}@postgres:5432/${POSTGRES_DB:-freenary}
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET:-dev_secret_change_me_at_least_32chars}
# OrbStack fronts *.orb.local with auto-HTTPS (trusted local CA); browsers land on
# https, so these origins must be https or the SPA's cross-origin calls fail CORS.
BETTER_AUTH_URL: https://${SERVER_HOST:-server.freenary.orb.local}
CORS_ORIGIN: https://${WEB_HOST:-web.freenary.orb.local}
AUTH_COOKIE_DOMAIN: ${AUTH_COOKIE_DOMAIN:-}
NODE_ENV: development
services:
postgres:
image: postgres:18-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-freenary}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
expose:
- "${POSTGRES_PORT:-5432}"
volumes:
- pgdata:/var/lib/postgresql
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-freenary}",
]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
# One-shot: applies pending migrations before the server starts.
# Re-runs on every `up` (idempotent); exits 0 when the schema is current.
bootstrap:
build: *app-build
working_dir: /app/packages/db
command: bun x prisma migrate deploy
environment:
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD:-password}@postgres:5432/${POSTGRES_DB:-freenary}
depends_on:
postgres:
condition: service_healthy
server:
build: *app-build
working_dir: /app/apps/server
command: bun run --hot src/index.ts
env_file: *app-env-file
environment:
<<: *app-env
labels:
# OrbStack's built-in proxy serves this container at server.freenary.orb.local;
# ignored outside OrbStack.
- dev.orbstack.domains=${SERVER_HOST:-server.freenary.orb.local}
- dev.orbstack.http-port=3000
develop:
watch: *app-watch
depends_on:
postgres:
condition: service_healthy
bootstrap:
condition: service_completed_successfully
restart: unless-stopped
web:
build: *app-build
working_dir: /app/apps/web
command: bun run dev -- --host 0.0.0.0
environment:
VITE_SERVER_URL: https://${SERVER_HOST:-server.freenary.orb.local}
# What the web app's own server calls while rendering a page: the
# container network, since OrbStack's local CA is not trusted inside it.
SERVER_URL: ${SERVER_URL:-http://server:3000}
labels:
- dev.orbstack.domains=${WEB_HOST:-web.freenary.orb.local}
- dev.orbstack.http-port=3001
develop:
watch: *app-watch
depends_on:
- server
restart: unless-stopped
docs:
build: *app-build
working_dir: /app/apps/fumadocs
command: bun run dev -- --host 0.0.0.0
environment:
DOCS_PORT: ${DOCS_PORT:-4000}
labels:
- dev.orbstack.domains=${DOCS_HOST:-docs.freenary.orb.local}
- dev.orbstack.http-port=4000
develop:
watch: *app-watch
restart: unless-stopped
volumes:
pgdata: