teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

5

dockerfileのFromを追記しました

2020/09/01 03:44

投稿

kokokouki
kokokouki

スコア6

title CHANGED
File without changes
body CHANGED
@@ -55,7 +55,8 @@
55
55
 
56
56
 
57
57
  ###dockerfile
58
+ ```
58
- ```FROM ruby:2.5
59
+ FROM ruby:2.5
59
60
  RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
60
61
 
61
62
  RUN mkdir /myapp

4

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

2020/09/01 03:43

投稿

kokokouki
kokokouki

スコア6

title CHANGED
File without changes
body CHANGED
@@ -54,6 +54,119 @@
54
54
  に変更しています。
55
55
 
56
56
 
57
+ ###dockerfile
58
+ ```FROM ruby:2.5
59
+ RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
60
+
61
+ RUN mkdir /myapp
62
+ WORKDIR /myapp
63
+
64
+ COPY Gemfile /myapp/Gemfile
65
+ COPY Gemfile.lock /myapp/Gemfile.lock
66
+
67
+ RUN gem install bundler && bundle install
68
+ COPY . /myapp
69
+ ```
70
+
71
+ ###docker-compose.yml
72
+ ```
73
+ version: '3'
74
+
75
+ services:
76
+ db:
77
+ image: mysql:5.7
78
+ environment:
79
+ MYSQL_USER: root
80
+ MYSQL_ROOT_PASSWORD: password
81
+ ports:
82
+ - "3306:3306"
83
+ volumes:
84
+ - ./db/mysql/volumes:/var/lib/mysql
85
+
86
+ web:
87
+ build: .
88
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
89
+ volumes:
90
+ - .:/myapp
91
+ - gem_data:/usr/local/bundle
92
+ ports:
93
+ - 3000:3000
94
+ depends_on:
95
+ - db
96
+ tty: true
97
+ stdin_open: true
98
+
99
+ volumes:
100
+ gem_data:
101
+ ```
102
+
103
+ ###gemfile
104
+ ```
105
+ source 'https://rubygems.org'
106
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
107
+
108
+ ruby '2.5.8'
109
+
110
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
111
+ gem 'rails', '~> 5.2.2'
112
+ # Use mysql as the database for Active Record
113
+ gem 'mysql2', '>= 0.4.4', '< 0.6.0'
114
+ # Use Puma as the app server
115
+ gem 'puma', '~> 3.11'
116
+ # Use SCSS for stylesheets
117
+ gem 'sass-rails', '~> 5.0'
118
+ # Use Uglifier as compressor for JavaScript assets
119
+ gem 'uglifier', '>= 1.3.0'
120
+ # See https://github.com/rails/execjs#readme for more supported runtimes
121
+ # gem 'mini_racer', platforms: :ruby
122
+
123
+ # Use CoffeeScript for .coffee assets and views
124
+ gem 'coffee-rails', '~> 4.2'
125
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
126
+ gem 'turbolinks', '~> 5'
127
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
128
+ gem 'jbuilder', '~> 2.5'
129
+ # Use Redis adapter to run Action Cable in production
130
+ # gem 'redis', '~> 4.0'
131
+ # Use ActiveModel has_secure_password
132
+ # gem 'bcrypt', '~> 3.1.7'
133
+
134
+ # Use ActiveStorage variant
135
+ # gem 'mini_magick', '~> 4.8'
136
+
137
+ # Use Capistrano for deployment
138
+ # gem 'capistrano-rails', group: :development
139
+
140
+ # Reduces boot times through caching; required in config/boot.rb
141
+ gem 'bootsnap', '>= 1.1.0', require: false
142
+
143
+ group :development, :test do
144
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
145
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
146
+ end
147
+
148
+ group :development do
149
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
150
+ gem 'web-console', '>= 3.3.0'
151
+ gem 'listen', '>= 3.0.5', '< 3.2'
152
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
153
+ gem 'spring'
154
+ gem 'spring-watcher-listen', '~> 2.0.0'
155
+ end
156
+
157
+ group :test do
158
+ # Adds support for Capybara system testing and selenium driver
159
+ gem 'capybara', '>= 2.15'
160
+ gem 'selenium-webdriver'
161
+ # Easy installation and use of chromedriver to run system tests with Chrome
162
+ gem 'chromedriver-helper'
163
+ end
164
+
165
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
166
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
167
+
168
+ ```
169
+
57
170
  ### 補足情報(FW/ツールのバージョンなど)
58
171
  macbook air
59
172
  mac Os catalina

3

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

2020/09/01 03:30

投稿

kokokouki
kokokouki

スコア6

title CHANGED
File without changes
body CHANGED
@@ -12,6 +12,7 @@
12
12
  $docker-compose build
13
13
  ~~~
14
14
  ~~~
15
+ 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.)
15
16
  web_1 | You must use Bundler 2 or greater with this lockfile.
16
17
  sample_app_web_1 exited with code 20
17
18
  ```
@@ -42,6 +43,7 @@
42
43
  $docker-compose up
43
44
  ~~~
44
45
  ~~~
46
+ 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.)
45
47
  web_1 | You must use Bundler 2 or greater with this lockfile.
46
48
  sample_app_web_1 exited with code 20
47
49
  ```

2

補足情報を修正しました

2020/09/01 02:51

投稿

kokokouki
kokokouki

スコア6

title CHANGED
File without changes
body CHANGED
@@ -56,6 +56,4 @@
56
56
  macbook air
57
57
  mac Os catalina
58
58
  ruby 2.5.8
59
- bundle 2.1.4
59
+ bundle 2.1.4
60
-
61
- ここにより詳細な情報を記載してください。

1

タグを修正しました

2020/09/01 02:20

投稿

kokokouki
kokokouki

スコア6

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