Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
107 lines (101 loc) · 3.22 KB
/
Copy pathcompose.yaml
File metadata and controls
107 lines (101 loc) · 3.22 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
# Development stack: Rails, background jobs, Tailwind watcher, and PostgreSQL.
# See docs/DOCKER.md.
#
# docker compose up -d --build
# docker compose logs -f web
#
# The database lives in the named volume pg_data, so it survives restarts,
# recreates, and rebuilds. Only `docker compose down -v` destroys it.
name: macronx
services:
db:
image: postgres:18
environment:
POSTGRES_USER: postgres
# Override by setting POSTGRES_PASSWORD in .env
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-macronx}
volumes:
# Postgres 18 stores data in /var/lib/postgresql/<major>/docker, so the
# volume is mounted at the parent directory. Mounting the old
# /var/lib/postgresql/data path instead leaves the data in the container
# layer, where it is lost on every recreate.
- pg_data:/var/lib/postgresql
# Port 5432 is not published: it would collide with a PostgreSQL server
# already running on the host. Uncomment and use 5433 to reach the database
# from the host.
# ports:
# - "127.0.0.1:5433:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 20
restart: unless-stopped
web:
build:
context: .
dockerfile: Dockerfile.dev
# bin/docker-entrypoint runs db:prepare for this exact command, which
# creates and migrates the databases on first boot and is a no-op after.
command: ["./bin/rails", "server"]
environment:
# Rails binds to localhost in development, which is unreachable from
# outside the container.
BINDING: "0.0.0.0"
PORT: "3000"
PGHOST: db
PGUSER: postgres
PGPASSWORD: ${POSTGRES_PASSWORD:-macronx}
# Comma-separated hostnames to allow besides localhost and IP addresses,
# for example the ngrok domain.
# RAILS_DEVELOPMENT_HOSTS: your-domain.ngrok-free.app
volumes:
- .:/rails
ports:
- "3000:3000"
# Lets the app reach Ollama, Whisper, and other services on the host.
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:3000/up"]
interval: 10s
timeout: 5s
retries: 30
start_period: 60s
depends_on:
db:
condition: service_healthy
restart: unless-stopped
stdin_open: true
tty: true
jobs:
build:
context: .
dockerfile: Dockerfile.dev
command: ["bin/jobs"]
environment:
PGHOST: db
PGUSER: postgres
PGPASSWORD: ${POSTGRES_PASSWORD:-macronx}
volumes:
- .:/rails
extra_hosts:
- "host.docker.internal:host-gateway"
# Waits for the web container, which is the one that runs db:prepare.
depends_on:
web:
condition: service_healthy
restart: unless-stopped
css:
build:
context: .
dockerfile: Dockerfile.dev
# The "always" argument puts Tailwind in polling mode. Without it the watcher
# builds once and exits, leaving this container in a restart loop. Note the
# rake argument syntax: the rails command runner rejects a bare "always".
command: ["bin/rails", "tailwindcss:watch[always]"]
volumes:
- .:/rails
restart: unless-stopped
volumes:
pg_data: