-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.local.yaml
More file actions
85 lines (82 loc) · 3.34 KB
/
Copy pathdocker-compose.local.yaml
File metadata and controls
85 lines (82 loc) · 3.34 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
# ─────────────────────────────────────────────────────────────────────────────
# OpenBlog — local source build compose (developer workflow)
# ─────────────────────────────────────────────────────────────────────────────
# Identical to docker-compose.prod.yaml but builds the image from the local
# Dockerfile instead of pulling from a registry.
#
# Use this when you're hacking on the codebase:
# docker compose -f docker-compose.local.yaml up -d --build
#
# To customize baked-in defaults (NEXT_PUBLIC_BLOG_NAME, etc.), edit the
# `ENV` block in Dockerfile before building.
#
# ⚠️ DATABASE NAME IS LOCKED TO `openblog` — DO NOT CHANGE ⚠️
#
# The Postgres service, the OpenBlog app, and the pg_cron extension all
# hard-code the database name `openblog`. See docker-compose.prod.yaml for the
# long-form explanation. In short: don't change POSTGRES_DB, the
# cron.database_name flag, or the /openblog path in DATABASE_URL — pg_cron
# and Prisma migrations won't follow.
# ─────────────────────────────────────────────────────────────────────────────
services:
postgres:
build:
context: .
dockerfile: Dockerfile.postgres
image: openblog-postgres:local
container_name: openblog-db
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (generate with `openssl rand -hex 32`)}
POSTGRES_DB: openblog
command:
- postgres
- -c
- shared_preload_libraries=pg_cron
- -c
- cron.database_name=openblog
- -c
- cron.use_background_workers=on
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${POSTGRES_HOST_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
app:
build:
context: .
dockerfile: Dockerfile
image: openblog:local
container_name: openblog-app
restart: unless-stopped
init: true
depends_on:
postgres:
condition: service_healthy
ports:
- "${APP_HOST_PORT:-3000}:3000"
environment:
DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/openblog?schema=public
BASE_URL: ${BASE_URL:-http://localhost:3000}
BLOG_NAME: ${BLOG_NAME:-OpenBlog}
BLOG_DESCRIPTION: ${BLOG_DESCRIPTION:-}
SITE_LOGO_URL: ${SITE_LOGO_URL:-}
SITE_CONTACT_EMAIL: ${SITE_CONTACT_EMAIL:-}
SITE_SOCIAL_URL: ${SITE_SOCIAL_URL:-}
NODE_ENV: production
PORT: 3000
AUTH_SECRET: ${AUTH_SECRET:?AUTH_SECRET must be set (generate with `openssl rand -base64 32`)}
SIGN_UP_ENABLED: ${SIGN_UP_ENABLED:-false}
SMTP_HOST: ${SMTP_HOST:-}
SMTP_PORT: ${SMTP_PORT:-}
SMTP_SECURE: ${SMTP_SECURE:-}
SMTP_USER: ${SMTP_USER:-}
SMTP_PASSWORD: ${SMTP_PASSWORD:-}
SMTP_FROM: ${SMTP_FROM:-}
volumes:
postgres_data: