#解決して欲しいこと
先日、RailsアプリケーションのDocker環境を整え、docker-compose upをするとしっかりとCSSが反映された画面が表示されることを確認しました。その後、一切コードには触れず、本日コンテナを再起動して再確認したところ画面のビューデザインが崩れて表示されました。
一切の心当たりがありません。何卒よろしくお願いします
#発生しているエラー
以下のようにwebコンテナでエラーが発生していることを確認しました
web_1 | Started GET "/" for 192.168.144.1 at 2021-05-17 05:36:01 +0000 web_1 | Cannot render console from 192.168.144.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1 web_1 | (0.8ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483 web_1 | (0.5ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC web_1 | Processing by PracticesController#index as HTML web_1 | Rendering practices/index.html.erb within layouts/application web_1 | Practice Load (0.5ms) SELECT `practices`.* FROM `practices` ORDER BY created_at DESC LIMIT 10 OFFSET 0 web_1 | ↳ app/views/practices/index.html.erb:15 web_1 | Rendered collection of partial/_practice.html.erb [0 times] (Duration: 0.0ms | Allocations: 3) web_1 | Rendered practices/index.html.erb within layouts/application (Duration: 23.3ms | Allocations: 3697) web_1 | Started GET "/" for 192.168.144.1 at 2021-05-17 05:36:07 +0000 web_1 | Cannot render console from 192.168.144.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1 web_1 | (0.6ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483 web_1 | Processing by PracticesController#index as HTML web_1 | Rendering practices/index.html.erb within layouts/application web_1 | Practice Load (3.0ms) SELECT `practices`.* FROM `practices` ORDER BY created_at DESC LIMIT 10 OFFSET 0 web_1 | ↳ app/views/practices/index.html.erb:15 web_1 | Rendered collection of partial/_practice.html.erb [0 times] (Duration: 0.1ms | Allocations: 3) web_1 | Rendered practices/index.html.erb within layouts/application (Duration: 9.4ms | Allocations: 1960) web_1 | [Webpacker] Everything's up-to-date. Nothing to do web_1 | [Webpacker] Everything's up-to-date. Nothing to do web_1 | Rendered partial/_header.html.erb (Duration: 4.7ms | Allocations: 782) web_1 | Rendered partial/_header.html.erb (Duration: 5.0ms | Allocations: 969) web_1 | Rendered partial/_flash.html.erb (Duration: 2.5ms | Allocations: 259) web_1 | Rendered partial/_flash.html.erb (Duration: 2.2ms | Allocations: 263) web_1 | Rendered partial/_backmenu.html.erb (Duration: 2.8ms | Allocations: 583) web_1 | Rendered partial/_backmenu.html.erb (Duration: 3.1ms | Allocations: 669) web_1 | [Webpacker] Everything's up-to-date. Nothing to do web_1 | [Webpacker] Everything's up-to-date. Nothing to do web_1 | Completed 200 OK in 14220ms (Views: 14215.4ms | ActiveRecord: 3.0ms | Allocations: 1935617) web_1 | web_1 | web_1 | Completed 200 OK in 19518ms (Views: 19451.6ms | ActiveRecord: 2.8ms | Allocations: 2554664) web_1 | web_1 | web_1 | Started GET "/packs/js/application-5a19e6f143a6efa2c5b8.js" for 192.168.144.1 at 2021-05-17 05:36:21 +0000 web_1 | Cannot render console from 192.168.144.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1 web_1 | web_1 | ActionController::RoutingError (No route matches [GET] "/packs/js/application-5a19e6f143a6efa2c5b8.js"):
#コード
Dockerfile
1FROM ruby:2.6.5 2RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ 3 && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list 4RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs yarn 5 6 7WORKDIR /soccer_app 8COPY Gemfile /soccer_app/Gemfile 9COPY Gemfile.lock /soccer_app/Gemfile.lock 10RUN gem install bundler 11RUN bundle install 12COPY . /soccer_app 13 14RUN yarn install --check-files 15RUN bundle exec rails webpacker:compile 16
docker-compose.yml
docker
1version: "3" 2services: 3 db: 4 image: mysql:5.7 5 environment: 6 MYSQL_ROOT_PASSWORD: "password" 7 ports: 8 - "4306:3306" 9 10 web: &app_base 11 build: . 12 command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'" 13 volumes: 14 - .:/soccer_app 15 ports: 16 - "3000:3000" 17 depends_on: 18 - db 19 - chrome 20 stdin_open: true 21 tty: true 22 environment: 23 BASIC_AUTH_USER: ${BASIC_AUTH_USER:-default} 24 BASIC_AUTH_PASSWORD: ${BASIC_AUTH_PASSWORD-default} 25 SELENIUM_DRIVER_URL: http://chrome:4444/wd/hub 26 27 webpacker: 28 <<: *app_base 29 command: bash -c "bundle exec bin/webpack-dev-server" 30 depends_on: 31 - web 32 ports: 33 - '3035:3035' 34 tty: false 35 stdin_open: false 36 environment: 37 BUNDLE_APP_CONFIG: ./.bundle 38 NODE_ENV: development 39 RAILS_ENV: development 40 WEBPACKER_DEV_SERVER_HOST: 0.0.0.0 41 42 chrome: #Chromeでのテスト実行用コンテナ 43 image: selenium/standalone-chrome #Chromeがインストールされたイメージ 44 ports: 45 - '4444:4444' 46
#おわりに
何卒よろしくお願いします
あなたの回答
tips
プレビュー