-
Notifications
You must be signed in to change notification settings - Fork 26
/
compose.yml.tt
180 lines (172 loc) · 4.01 KB
/
compose.yml.tt
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
x-app: &app
build:
context: .
args:
RUBY_VERSION: '<%= ruby_version %>'
<% if postgres_version %>
PG_MAJOR: '<%= postgres_version.split('.', 2).first %>'
<% end %>
<% if node_version %>
NODE_MAJOR: '<%= node_version.split('.', 2).first %>'
<% end %>
<% if yarn_version && yarn_version != 'latest' %>
YARN_VERSION: '<%= yarn_version %>'
<% end %>
image: <%= app_name %>-dev:1.0.0
environment: &env
<% if node_version %>
NODE_ENV: ${NODE_ENV:-development}
<% end %>
RAILS_ENV: ${RAILS_ENV:-development}
tmpfs:
- /tmp
- /app/tmp/pids
x-backend: &backend
<<: *app
stdin_open: true
tty: true
volumes:
- ..:/app:cached
- bundle:/usr/local/bundle
- rails_cache:/app/tmp/cache
<% if File.directory?("app/assets") %>
- assets:/app/public/assets
<% end %>
<% if node_version %>
- node_modules:/app/node_modules
<% end %>
<% if gemspecs.key?("webpacker") %>
- packs:/app/public/packs
- packs-test:/app/public/packs-test
<% end %>
- history:/usr/local/hist
<% if postgres_version %>
- ./.psqlrc:/root/.psqlrc:ro
<% end %>
- ./.bashrc:/root/.bashrc:ro
environment: &backend_environment
<<: *env
<% if redis_version %>
REDIS_URL: redis://redis:6379/
<% end %>
<% if database_url %>
DATABASE_URL: postgres://postgres:postgres@postgres:5432
<% end %>
<% if gemspecs.key?("webpacker") %>
WEBPACKER_DEV_SERVER_HOST: webpacker
<% end %>
MALLOC_ARENA_MAX: 2
WEB_CONCURRENCY: ${WEB_CONCURRENCY:-1}
BOOTSNAP_CACHE_DIR: /usr/local/bundle/_bootsnap
XDG_DATA_HOME: /app/tmp/caches
<% if yarn_version %>
YARN_CACHE_FOLDER: /app/node_modules/.yarn-cache
<% end %>
HISTFILE: /usr/local/hist/.bash_history
<% if postgres_version %>
PSQL_HISTFILE: /usr/local/hist/.psql_history
<% end %>
IRB_HISTFILE: /usr/local/hist/.irb_history
EDITOR: vi
<% if postgres_version || redis_version %>
depends_on:
<% if postgres_version %>
postgres:
condition: service_healthy
<% end %>
<% if redis_version %>
redis:
condition: service_healthy
<% end %>
<% end %>
services:
rails:
<<: *backend
command: bundle exec rails
web:
<<: *backend
command: bundle exec rails server -b 0.0.0.0
ports:
- '3000:3000'
<% if gemspecs.key?("webpacker") || gemspecs.key?("sidekiq") %>
depends_on:
<% if gemspecs.key?("webpacker") %>
webpacker:
condition: service_started
<% end %>
<% if gemspecs.key?("sidekiq") %>
sidekiq:
condition: service_started
<% end %>
<% end %>
<% if gemspecs.key?("sidekiq") %>
sidekiq:
<<: *backend
command: bundle exec sidekiq
<% end %>
<% if postgres_version %>
postgres:
image: postgres:<%= postgres_version %>
volumes:
- .psqlrc:/root/.psqlrc:ro
- postgres:/var/lib/postgresql/data
- history:/user/local/hist
environment:
PSQL_HISTFILE: /user/local/hist/.psql_history
POSTGRES_PASSWORD: postgres
ports:
- 5432
healthcheck:
test: pg_isready -U postgres -h 127.0.0.1
interval: 5s
<% end %>
<% if redis_version %>
redis:
image: redis:<%= redis_version %>-alpine
volumes:
- redis:/data
ports:
- 6379
healthcheck:
test: redis-cli ping
interval: 1s
timeout: 3s
retries: 30
<% end %>
<% if gemspecs.key?("webpacker") %>
webpacker:
<<: *app
command: bundle exec ./bin/webpack-dev-server
ports:
- '3035:3035'
volumes:
- ..:/app:cached
- bundle:/usr/local/bundle
- node_modules:/app/node_modules
- packs:/app/public/packs
- packs-test:/app/public/packs-test
environment:
<<: *env
WEBPACKER_DEV_SERVER_HOST: 0.0.0.0
YARN_CACHE_FOLDER: /app/node_modules/.yarn-cache
<% end %>
volumes:
bundle:
<% if node_version %>
node_modules:
<% end %>
history:
rails_cache:
<% if postgres_version %>
postgres:
<% end %>
<% if redis_version %>
redis:
<% end %>
<% if File.directory?("app/assets") %>
assets:
<% end %>
<% if gemspecs.key?("webpacker") %>
packs:
packs-test:
<% end %>