質問編集履歴
2
ファイル名プレビューで映るように
title
CHANGED
File without changes
|
body
CHANGED
@@ -143,8 +143,9 @@
|
|
143
143
|
|
144
144
|
```
|
145
145
|
|
146
|
+
docker-compose.yml
|
146
147
|
|
147
|
-
```
|
148
|
+
```
|
148
149
|
version: '3'
|
149
150
|
services:
|
150
151
|
db:
|
@@ -214,6 +215,9 @@
|
|
214
215
|
|
215
216
|
```
|
216
217
|
|
218
|
+
|
219
|
+
webpacker.yml
|
220
|
+
|
217
221
|
```webpacker.yml
|
218
222
|
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
219
223
|
|
1
補足情報を追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -105,4 +105,211 @@
|
|
105
105
|
ruby 2.6.3
|
106
106
|
Rails 6.0.3.4
|
107
107
|
webpacker 4.3.0
|
108
|
-
Docker version 20.10.2
|
108
|
+
Docker version 20.10.2
|
109
|
+
|
110
|
+
```Dockerfile
|
111
|
+
FROM ruby:2.7
|
112
|
+
RUN apt-get update -qq && \
|
113
|
+
apt-get install -y apt-utils \
|
114
|
+
build-essential \
|
115
|
+
libpq-dev \
|
116
|
+
nodejs \
|
117
|
+
default-mysql-client \
|
118
|
+
yarn
|
119
|
+
RUN mkdir /myapp
|
120
|
+
WORKDIR /myapp
|
121
|
+
COPY Gemfile /myapp/Gemfile
|
122
|
+
COPY Gemfile.lock /myapp/Gemfile.lock
|
123
|
+
RUN bundle install
|
124
|
+
COPY . /myapp
|
125
|
+
USER postgres
|
126
|
+
|
127
|
+
|
128
|
+
# Add a script to be executed every time the container starts.
|
129
|
+
COPY entrypoint.sh /usr/bin/
|
130
|
+
RUN chmod +x /usr/bin/entrypoint.sh
|
131
|
+
ENTRYPOINT ["entrypoint.sh"]
|
132
|
+
EXPOSE 3000
|
133
|
+
|
134
|
+
# Start the main process.
|
135
|
+
CMD ["rails", "server", "-b", "0.0.0.0"]
|
136
|
+
|
137
|
+
# Railsに必要なパッケージをインストール
|
138
|
+
RUN apt-get update -qq && apt-get install -y nodejs
|
139
|
+
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
|
140
|
+
&& apt-get install -y nodejs
|
141
|
+
|
142
|
+
EXPOSE 8080
|
143
|
+
|
144
|
+
```
|
145
|
+
|
146
|
+
|
147
|
+
```docker-compose.yml
|
148
|
+
version: '3'
|
149
|
+
services:
|
150
|
+
db:
|
151
|
+
image: postgres
|
152
|
+
volumes:
|
153
|
+
- ./tmp/db:/var/lib/postgresql/data
|
154
|
+
environment:
|
155
|
+
POSTGRES_PASSWORD: 'postgres'
|
156
|
+
web:
|
157
|
+
build: .
|
158
|
+
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
|
159
|
+
volumes:
|
160
|
+
- .:/myapp
|
161
|
+
ports:
|
162
|
+
- "3000:3000"
|
163
|
+
depends_on:
|
164
|
+
- db
|
165
|
+
|
166
|
+
postgres:
|
167
|
+
image: postgres:13
|
168
|
+
user: postgres
|
169
|
+
|
170
|
+
```
|
171
|
+
|
172
|
+
```Gemfile
|
173
|
+
source 'https://rubygems.org'
|
174
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
175
|
+
|
176
|
+
|
177
|
+
gem 'rails', '~> 6.0.3.4'
|
178
|
+
gem 'puma', '~> 3.11'
|
179
|
+
gem 'sassc-rails', '2.1.2'
|
180
|
+
gem 'uglifier', '>= 1.3.0'
|
181
|
+
gem 'coffee-rails', '~> 4.2'
|
182
|
+
gem 'turbolinks', '~> 5'
|
183
|
+
gem 'jbuilder', '~> 2.5'
|
184
|
+
gem 'bootsnap', '>= 1.1.0', require: false
|
185
|
+
gem 'bootstrap', '~> 4.5.0'
|
186
|
+
gem 'jquery-rails'
|
187
|
+
gem 'webpacker', '~> 4.0'
|
188
|
+
|
189
|
+
|
190
|
+
group :development, :test do
|
191
|
+
gem 'rspec-rails'
|
192
|
+
gem 'sqlite3'
|
193
|
+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
194
|
+
end
|
195
|
+
|
196
|
+
group :development do
|
197
|
+
gem 'web-console', '>= 3.3.0'
|
198
|
+
gem 'listen', '>= 3.0.5', '< 3.2'
|
199
|
+
gem 'spring'
|
200
|
+
gem 'spring-watcher-listen', '~> 2.0.0'
|
201
|
+
end
|
202
|
+
|
203
|
+
group :test do
|
204
|
+
gem 'capybara', '>= 2.15'
|
205
|
+
gem 'selenium-webdriver'
|
206
|
+
gem 'chromedriver-helper'
|
207
|
+
end
|
208
|
+
|
209
|
+
group :production do
|
210
|
+
gem 'pg'
|
211
|
+
end
|
212
|
+
|
213
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
214
|
+
|
215
|
+
```
|
216
|
+
|
217
|
+
```webpacker.yml
|
218
|
+
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
219
|
+
|
220
|
+
default: &default
|
221
|
+
source_path: app/javascript
|
222
|
+
source_entry_path: packs
|
223
|
+
public_root_path: public
|
224
|
+
public_output_path: packs
|
225
|
+
cache_path: tmp/cache/webpacker
|
226
|
+
check_yarn_integrity: false
|
227
|
+
webpack_compile_output: true
|
228
|
+
|
229
|
+
# Additional paths webpack should lookup modules
|
230
|
+
# ['app/assets', 'engine/foo/app/assets']
|
231
|
+
resolved_paths: []
|
232
|
+
|
233
|
+
# Reload manifest.json on all requests so we reload latest compiled packs
|
234
|
+
cache_manifest: false
|
235
|
+
|
236
|
+
# Extract and emit a css file
|
237
|
+
extract_css: false
|
238
|
+
|
239
|
+
static_assets_extensions:
|
240
|
+
- .jpg
|
241
|
+
- .jpeg
|
242
|
+
- .png
|
243
|
+
- .gif
|
244
|
+
- .tiff
|
245
|
+
- .ico
|
246
|
+
- .svg
|
247
|
+
- .eot
|
248
|
+
- .otf
|
249
|
+
- .ttf
|
250
|
+
- .woff
|
251
|
+
- .woff2
|
252
|
+
|
253
|
+
extensions:
|
254
|
+
- .mjs
|
255
|
+
- .js
|
256
|
+
- .sass
|
257
|
+
- .scss
|
258
|
+
- .css
|
259
|
+
- .module.sass
|
260
|
+
- .module.scss
|
261
|
+
- .module.css
|
262
|
+
- .png
|
263
|
+
- .svg
|
264
|
+
- .gif
|
265
|
+
- .jpeg
|
266
|
+
- .jpg
|
267
|
+
|
268
|
+
development:
|
269
|
+
<<: *default
|
270
|
+
compile: true
|
271
|
+
|
272
|
+
# Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
|
273
|
+
check_yarn_integrity: true
|
274
|
+
|
275
|
+
# Reference: https://webpack.js.org/configuration/dev-server/
|
276
|
+
dev_server:
|
277
|
+
https: false
|
278
|
+
host: localhost
|
279
|
+
port: 3035
|
280
|
+
public: localhost:3035
|
281
|
+
hmr: false
|
282
|
+
# Inline should be set to true if using HMR
|
283
|
+
inline: true
|
284
|
+
overlay: true
|
285
|
+
compress: true
|
286
|
+
disable_host_check: true
|
287
|
+
use_local_ip: false
|
288
|
+
quiet: false
|
289
|
+
pretty: false
|
290
|
+
headers:
|
291
|
+
'Access-Control-Allow-Origin': '*'
|
292
|
+
watch_options:
|
293
|
+
ignored: '**/node_modules/**'
|
294
|
+
|
295
|
+
|
296
|
+
test:
|
297
|
+
<<: *default
|
298
|
+
compile: true
|
299
|
+
|
300
|
+
# Compile test packs to a separate directory
|
301
|
+
public_output_path: packs-test
|
302
|
+
|
303
|
+
production:
|
304
|
+
<<: *default
|
305
|
+
|
306
|
+
# Production depends on precompilation of packs prior to booting for performance.
|
307
|
+
compile: false
|
308
|
+
|
309
|
+
# Extract and emit a css file
|
310
|
+
extract_css: true
|
311
|
+
|
312
|
+
# Cache manifest.json for performance
|
313
|
+
cache_manifest: true
|
314
|
+
|
315
|
+
```
|