-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
107 lines (100 loc) · 3.18 KB
/
Copy pathdocker-compose.yml
File metadata and controls
107 lines (100 loc) · 3.18 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
name: articles
services:
# ---------------------------------------------------------------------------
# Our stack.
# ---------------------------------------------------------------------------
postgres:
image: postgres:17
container_name: articles_postgres
environment:
POSTGRES_DB: articles_db
POSTGRES_USER: developer
POSTGRES_PASSWORD: devpassword
ports:
- "5442:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U developer -d articles_db"]
interval: 5s
timeout: 5s
retries: 10
api:
build:
context: ./backend
container_name: articles_api
environment:
QUEUE_ENDPOINT: http://elasticmq:9324
QUEUE_URL: http://elasticmq:9324/000000000000/article-status-changes
ports:
- "8091:8081"
volumes:
- ./backend:/app
- go_mod_cache:/go/pkg/mod
- go_build_cache:/root/.cache/go-build
depends_on:
postgres:
condition: service_healthy
elasticmq:
condition: service_started
frontend:
build:
context: ./frontend
container_name: articles_frontend
environment:
ARTICLES_API_URL: http://api:8081
SERVER_LISTEN_ADDR: 0.0.0.0:3010
# Resolved by the browser, so this is a host address rather than a
# container one.
VITE_IMAGE_BASE_URL: http://localhost:8092
ports:
- "5183:5183"
- "3010:3010"
volumes:
- ./frontend:/app
# Keeps the image's node_modules rather than letting the bind mount hide
# them. Run `make reinstall-frontend` after changing package.json.
- frontend_node_modules:/app/node_modules
# Mounted at the path `../backend/api/proto` resolves to from /app, so
# `pnpm generate` works the same inside the container and on your machine.
- ./backend/api/proto:/backend/api/proto:ro
depends_on:
- api
# ---------------------------------------------------------------------------
# Stands in for services we do not own. See external/README.md.
# Treat these as managed infrastructure: you would not deploy or patch them.
# ---------------------------------------------------------------------------
elasticmq:
image: softwaremill/elasticmq-native:1.6.14
container_name: articles_queue
ports:
- "9324:9324"
- "9325:9325"
volumes:
- ./external/elasticmq/elasticmq.conf:/opt/elasticmq.conf:ro
cdn:
image: nginx:1.29-alpine
container_name: articles_cdn
ports:
- "8092:80"
volumes:
- ./external/cdn/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ./external/cdn/images:/usr/share/nginx/html:ro
consumer:
build:
context: ./external/consumer
container_name: articles_consumer
environment:
DATABASE_URL: postgres://developer:devpassword@postgres:5432/articles_db?sslmode=disable
QUEUE_ENDPOINT: http://elasticmq:9324
QUEUE_URL: http://elasticmq:9324/000000000000/article-status-changes
depends_on:
postgres:
condition: service_healthy
elasticmq:
condition: service_started
volumes:
postgres_data:
frontend_node_modules:
go_mod_cache:
go_build_cache: