Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
87 lines (83 loc) · 2.58 KB
/
Copy pathdocker-compose.yml
File metadata and controls
87 lines (83 loc) · 2.58 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
services:
postgres:
image: postgres:17-alpine
container_name: guildchat-postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: guildchat
ports:
- "127.0.0.1:5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d guildchat"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: guildchat-backend
# the mounted keys/ is owned by the host user; run as that same uid so
# private.pem stays 0600 instead of being opened up to `other`
user: "${UID:-1000}:${GID:-1000}"
ports:
- "8080:8080"
depends_on:
postgres:
condition: service_healthy
env_file:
- ./backend/.env
environment:
# overrides .env: inside the compose network the DB is reachable
# by its service name, not localhost
DB_HOST: postgres
# keys/ lives outside the build context, so it is mounted at runtime
JWT_PRIVATE_KEY_PATH: /backend/keys/private.pem
JWT_PUBLIC_KEY_PATH: /backend/keys/public.pem
volumes:
- ./keys:/backend/keys:ro
restart: unless-stopped
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: guildchat-frontend
# nginx serves the built SPA and proxies /api and /ws to the backend, so
# the browser only ever talks to this one origin
ports:
- "3000:80"
depends_on:
- backend
environment:
BACKEND_URL: http://backend:8080
restart: unless-stopped
# dev-only database browser. Not started by `make up`; run `make pgadmin`
# (i.e. `docker compose --profile tools up -d pgadmin`).
pgadmin:
image: dpage/pgadmin4:latest
container_name: guildchat-pgadmin
profiles: ["tools"]
depends_on:
postgres:
condition: service_healthy
environment:
PGADMIN_DEFAULT_EMAIL: dev@guildchat.io
PGADMIN_DEFAULT_PASSWORD: pgadmin
# single-user dev box: skip the pgAdmin login screen entirely
PGADMIN_CONFIG_SERVER_MODE: "False"
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False"
ports:
- "127.0.0.1:5050:80"
volumes:
# preloads the GuildChat connection on first boot; the password is
# `postgres`, typed once and saved via "Save password" in the dialog
- ./dev/pgadmin/servers.json:/pgadmin4/servers.json:ro
- pgadmin_data:/var/lib/pgadmin
restart: unless-stopped
volumes:
postgres_data:
pgadmin_data: