-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
76 lines (75 loc) · 1.88 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
services:
db:
image: postgres:latest
env_file: .env
container_name: bookworm-postgres
volumes:
- postgres_data:/var/lib/postgresql/data
command: "postgres -c 'max_connections=500'"
environment:
POSTGRES_DB: bookworm_production
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d bookworm_production -U postgres" ]
interval: 10s
timeout: 5s
retries: 10
rails:
build: ./rails
container_name: bookworm-rails
command: "bundle exec rails s -p 3001 -b '0.0.0.0'"
env_file: .env
environment:
RAILS_MASTER_KEY: $RAILS_MASTER_KEY
DB_HOST: db
DB_NAME: bookworm_production
DB_USERNAME: bookworm
DB_PASSWORD: $POSTGRES_PASSWORD
RAILS_ENV: production
healthcheck:
test: [ "CMD-SHELL", "curl -d 'query{investigations {id name}}' -X POST http://localhost:3001/graphql || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
depends_on:
db:
condition: service_healthy
react:
build: ./react
container_name: bookworm-react
env_file: .env
environment:
NODE_ENV: production
RAILS_API_URL: $RAILS_API_URL
ports:
- 3000:80
healthcheck:
test: [ "CMD-SHELL", "wget --no-verbose --spider --tries=1 localhost:3000 || exit 1" ]
interval: 10s
timeout: 5s
retries: 10
depends_on:
db:
condition: service_healthy
rails:
condition: service_healthy
nginx:
image: "nginx:latest"
container_name: "bookworm-nginx"
ports:
- 443:443
- 80:80
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/certs:/etc/ssl
restart: unless-stopped
depends_on:
rails:
condition: service_healthy
react:
condition: service_healthy
volumes:
postgres_data: {}
networks:
default:
name: bookworm