-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
148 lines (135 loc) · 3.46 KB
/
docker-compose.yml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
x-service-app: &service-app
depends_on:
# Wait for the database to be ready
db:
condition: service_healthy
# Wait for the migration to be completed
migration:
condition: service_completed_successfully
x-backend-app: &backend-app
<<: *service-app
command: ['node', '--watch', './dist/app.js']
services:
db:
image: postgres:13.9
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: membership_system
POSTGRES_PASSWORD: membership_system
POSTGRES_DB: membership_system
# Healthcheck for the database
healthcheck:
test: ["CMD-SHELL", "pg_isready -U membership_system"]
interval: 5s
timeout: 5s
retries: 5
ports:
- ${DB_PORT}:5432
mail:
image: maildev/maildev:2.1.0
ports:
- ${MAIL_PORT}:1080
# Legacy app
app:
<<: *backend-app
build:
context: .
dockerfile: ./packages/docker/base.dockerfile
target: legacy_app
env_file:
- .env
volumes:
- ./packages:/opt/packages
- ./apps/legacy/dist:/opt/apps/legacy/dist
# API app
api_app:
<<: *backend-app
build:
context: .
dockerfile: ./packages/docker/base.dockerfile
target: api_app
env_file:
- .env
volumes:
- ./packages:/opt/packages
- ./apps/backend/built:/opt/apps/backend/built
- ./apps/backend-cli/dist:/opt/apps/backend-cli/dist
# Allow migrations to be written out from the container
- ./packages/core/src/migrations:/opt/packages/core/src/migrations
# TODO: Use standard dist folder
command: ['node', '--watch', './built/api/app.js']
# Webhook app
webhook_app:
<<: *backend-app
build:
context: .
dockerfile: ./packages/docker/base.dockerfile
target: webhook_app
env_file:
- .env
volumes:
- ./packages:/opt/packages
- ./apps/webhooks/dist:/opt/apps/webhooks/dist
# Cron app
cron_app:
<<: *service-app
build:
context: .
dockerfile: ./packages/docker/base.dockerfile
target: cron_app
env_file:
- .env
# Image upload handler
img_upload_app:
image: beabee/pictshare:v0.2.0
environment:
URL: ${BEABEE_AUDIENCE}/uploads/
volumes:
- upload_data:/var/www/data
# The new frontend
frontend:
build:
context: .
dockerfile: ./apps/frontend/Dockerfile
args:
- VERSION=${VERSION}
- REVISION=${REVISION}
env_file:
- ./apps/frontend/.env
# Application router
app_router:
build:
context: .
dockerfile: ./apps/router/Dockerfile
environment:
LEGACY_APP_COOKIE_DOMAIN: ${BEABEE_COOKIE_DOMAIN}
TRUSTED_ORIGINS: ${BEABEE_TRUSTEDORIGINS-}
ports:
- ${ROUTER_PORT}:80
# Database migration service
migration:
build:
context: .
dockerfile: ./packages/docker/base.dockerfile
target: api_app
command: 'npm run typeorm migration:run'
# Wait for the database to be ready
depends_on:
db:
condition: service_healthy
env_file:
- .env
# Stripe CLI for webhook forwarding
# Only used in local development
stripe_cli:
image: stripe/stripe-cli:latest
command: "listen --api-key ${BEABEE_STRIPE_SECRETKEY} --forward-to webhook_app:3000/stripe"
depends_on:
- webhook_app
environment:
- STRIPE_API_KEY=${BEABEE_STRIPE_SECRETKEY}
- STRIPE_DEVICE_NAME=beabee-dev-docker-container
volumes:
db_data:
upload_data: