-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
153 lines (138 loc) · 3.28 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
149
150
151
152
153
version: "2.4"
x-app: &app
build:
context: .
dockerfile: ./.dockerdev/Dockerfile
args:
RUBY_VERSION: "2.6.6-slim-buster"
NODE_MAJOR: "14"
YARN_VERSION: "1.22.5"
BUNDLER_VERSION: "2.2.16"
image: app_name-dev:1.0.0
# user: $(id -u):$(id -g)
tmpfs:
- /tmp
x-backend: &backend
<<: *app
stdin_open: true
tty: true
volumes:
- .:/app:cached
- rails_cache:/app/tmp/cache
- bundle:/usr/local/bundle
- node_modules:/app/node_modules
- packs:/app/public/packs
- .dockerdev/.psqlrc:/root/.psqlrc:ro
- .dockerdev/.bashrc:/root/.bashrc:ro
- ~/.ssh:/root/.ssh:ro
environment:
- NODE_ENV=${NODE_ENV:-development}
- RAILS_ENV=${RAILS_ENV:-development}
- DB_HOST=db
- WEBPACKER_DEV_SERVER_HOST=webpacker
- HISTFILE=/app/log/.bash_history
- EDITOR=vi
- REDIS_URL=redis://redis:6379/1
- VIRTUAL_HOST=app_name.vcap.me
- VIRTUAL_PORT=3000
env_file:
- .env/database
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
services:
proxy:
container_name: proxy
image: jwilder/nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
# - //var/run/docker.sock:/var/run/docker.sock:ro # for windows
- ./.dockerdev/certs:/etc/nginx/certs
app:
<<: *backend
container_name: app_name_app
command: bash -c "rm -f tmp/pids/server.pid && rails s -b 0.0.0.0"
environment:
ports:
- "3000:3000"
#https://pamit.medium.com/docker-a-health-check-story-c528d0b5fe10
healthcheck:
test: curl --fail http://localhost:3000 || exit 1
interval: 10s
timeout: 10s
start_period: 10s
retries: 3
sidekiq:
<<: *backend
container_name: app_name_sidekiq
command: bin/bundle exec sidekiq -C config/sidekiq.yml
db:
image: mysql:5.7
container_name: app_name_db
mem_limit: 300m
ports:
- 3306
volumes:
- db:/var/lib/mysql
env_file:
- .env/database
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
timeout: 20s
retries: 10
db:
image: postgres:12.4
container_name: app_name_db
volumes:
- .dockerdev/.psqlrc:/root/.psqlrc:ro
- db:/var/lib/postgresql/data
- ./log:/root/log:cached
environment:
- PSQL_HISTFILE=/root/log/.psql_history
- POSTGRES_HOST_AUTH_METHOD=trust
env_file:
- .env/database
ports:
- 5432
healthcheck:
test: pg_isready -U postgres -h 127.0.0.1
interval: 5s
redis:
image: redis
container_name: app_name_redis
volumes:
- redis:/var/lib/redis/data
ports:
- 6379
healthcheck:
test: redis-cli ping
interval: 1s
timeout: 3s
retries: 30
webpacker:
<<: *app
container_name: app_name_webpacker
command: ./bin/webpack-dev-server
ports:
- "3035:3035"
volumes:
- .:/app:cached
- bundle:/usr/local/bundle
- node_modules:/app/node_modules
- packs:/app/public/packs
environment:
- NODE_ENV=${NODE_ENV:-development}
- RAILS_ENV=${RAILS_ENV:-development}
- WEBPACKER_DEV_SERVER_HOST=0.0.0.0
volumes:
db:
redis:
bundle:
node_modules:
rails_cache:
packs: