質問編集履歴

5

dockerfileのFromを追記しました

2020/09/01 03:44

投稿

kokokouki
kokokouki

スコア6

test CHANGED
File without changes
test CHANGED
@@ -112,7 +112,9 @@
112
112
 
113
113
  ###dockerfile
114
114
 
115
+ ```
116
+
115
- ```FROM ruby:2.5
117
+ FROM ruby:2.5
116
118
 
117
119
  RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
118
120
 

4

dockerfile,docker-compose.yml,gemfileを追記しました。

2020/09/01 03:43

投稿

kokokouki
kokokouki

スコア6

test CHANGED
File without changes
test CHANGED
@@ -110,6 +110,232 @@
110
110
 
111
111
 
112
112
 
113
+ ###dockerfile
114
+
115
+ ```FROM ruby:2.5
116
+
117
+ RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
118
+
119
+
120
+
121
+ RUN mkdir /myapp
122
+
123
+ WORKDIR /myapp
124
+
125
+
126
+
127
+ COPY Gemfile /myapp/Gemfile
128
+
129
+ COPY Gemfile.lock /myapp/Gemfile.lock
130
+
131
+
132
+
133
+ RUN gem install bundler && bundle install
134
+
135
+ COPY . /myapp
136
+
137
+ ```
138
+
139
+
140
+
141
+ ###docker-compose.yml
142
+
143
+ ```
144
+
145
+ version: '3'
146
+
147
+
148
+
149
+ services:
150
+
151
+ db:
152
+
153
+ image: mysql:5.7
154
+
155
+ environment:
156
+
157
+ MYSQL_USER: root
158
+
159
+ MYSQL_ROOT_PASSWORD: password
160
+
161
+ ports:
162
+
163
+ - "3306:3306"
164
+
165
+ volumes:
166
+
167
+ - ./db/mysql/volumes:/var/lib/mysql
168
+
169
+
170
+
171
+ web:
172
+
173
+ build: .
174
+
175
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
176
+
177
+ volumes:
178
+
179
+ - .:/myapp
180
+
181
+ - gem_data:/usr/local/bundle
182
+
183
+ ports:
184
+
185
+ - 3000:3000
186
+
187
+ depends_on:
188
+
189
+ - db
190
+
191
+ tty: true
192
+
193
+ stdin_open: true
194
+
195
+
196
+
197
+ volumes:
198
+
199
+ gem_data:
200
+
201
+ ```
202
+
203
+
204
+
205
+ ###gemfile
206
+
207
+ ```
208
+
209
+ source 'https://rubygems.org'
210
+
211
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
212
+
213
+
214
+
215
+ ruby '2.5.8'
216
+
217
+
218
+
219
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
220
+
221
+ gem 'rails', '~> 5.2.2'
222
+
223
+ # Use mysql as the database for Active Record
224
+
225
+ gem 'mysql2', '>= 0.4.4', '< 0.6.0'
226
+
227
+ # Use Puma as the app server
228
+
229
+ gem 'puma', '~> 3.11'
230
+
231
+ # Use SCSS for stylesheets
232
+
233
+ gem 'sass-rails', '~> 5.0'
234
+
235
+ # Use Uglifier as compressor for JavaScript assets
236
+
237
+ gem 'uglifier', '>= 1.3.0'
238
+
239
+ # See https://github.com/rails/execjs#readme for more supported runtimes
240
+
241
+ # gem 'mini_racer', platforms: :ruby
242
+
243
+
244
+
245
+ # Use CoffeeScript for .coffee assets and views
246
+
247
+ gem 'coffee-rails', '~> 4.2'
248
+
249
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
250
+
251
+ gem 'turbolinks', '~> 5'
252
+
253
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
254
+
255
+ gem 'jbuilder', '~> 2.5'
256
+
257
+ # Use Redis adapter to run Action Cable in production
258
+
259
+ # gem 'redis', '~> 4.0'
260
+
261
+ # Use ActiveModel has_secure_password
262
+
263
+ # gem 'bcrypt', '~> 3.1.7'
264
+
265
+
266
+
267
+ # Use ActiveStorage variant
268
+
269
+ # gem 'mini_magick', '~> 4.8'
270
+
271
+
272
+
273
+ # Use Capistrano for deployment
274
+
275
+ # gem 'capistrano-rails', group: :development
276
+
277
+
278
+
279
+ # Reduces boot times through caching; required in config/boot.rb
280
+
281
+ gem 'bootsnap', '>= 1.1.0', require: false
282
+
283
+
284
+
285
+ group :development, :test do
286
+
287
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
288
+
289
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
290
+
291
+ end
292
+
293
+
294
+
295
+ group :development do
296
+
297
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
298
+
299
+ gem 'web-console', '>= 3.3.0'
300
+
301
+ gem 'listen', '>= 3.0.5', '< 3.2'
302
+
303
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
304
+
305
+ gem 'spring'
306
+
307
+ gem 'spring-watcher-listen', '~> 2.0.0'
308
+
309
+ end
310
+
311
+
312
+
313
+ group :test do
314
+
315
+ # Adds support for Capybara system testing and selenium driver
316
+
317
+ gem 'capybara', '>= 2.15'
318
+
319
+ gem 'selenium-webdriver'
320
+
321
+ # Easy installation and use of chromedriver to run system tests with Chrome
322
+
323
+ gem 'chromedriver-helper'
324
+
325
+ end
326
+
327
+
328
+
329
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
330
+
331
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
332
+
333
+
334
+
335
+ ```
336
+
337
+
338
+
113
339
  ### 補足情報(FW/ツールのバージョンなど)
114
340
 
115
341
  macbook air

3

docker-compose時のエラーメッセージを少し前から載せ直しました。

2020/09/01 03:30

投稿

kokokouki
kokokouki

スコア6

test CHANGED
File without changes
test CHANGED
@@ -25,6 +25,8 @@
25
25
  ~~~
26
26
 
27
27
  ~~~
28
+
29
+ db_1 | 2020-08-30T11:18:13.589101Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 2109328ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
28
30
 
29
31
  web_1 | You must use Bundler 2 or greater with this lockfile.
30
32
 
@@ -86,6 +88,8 @@
86
88
 
87
89
  ~~~
88
90
 
91
+ db_1 | 2020-08-30T11:18:13.589101Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 2109328ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
92
+
89
93
  web_1 | You must use Bundler 2 or greater with this lockfile.
90
94
 
91
95
  sample_app_web_1 exited with code 20

2

補足情報を修正しました

2020/09/01 02:51

投稿

kokokouki
kokokouki

スコア6

test CHANGED
File without changes
test CHANGED
@@ -115,7 +115,3 @@
115
115
  ruby 2.5.8
116
116
 
117
117
  bundle 2.1.4
118
-
119
-
120
-
121
- ここにより詳細な情報を記載してください。

1

タグを修正しました

2020/09/01 02:20

投稿

kokokouki
kokokouki

スコア6

test CHANGED
@@ -1 +1 @@
1
- docker + rails + mysql で環境構築時のbundleに関するエラーについて
1
+ docker + rails + mysql で環境構築時docker-composeした時のbundleに関するエラーについて
test CHANGED
File without changes