LoginSignup
8
5

More than 5 years have passed since last update.

Docker上でrails/webpackerなアプリケーションの開発用DockerfileではNODE_ENVを明示的にdevelopmentに指定してyarn installしよう

Last updated at Posted at 2018-04-28

タイトルの通り。

RUN yarn install

...

EXPOSE 3000
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]

とやって、、、

$ docker run <<↑のDockerfileをbuildしてできたimage>>

すると

=> Booting Puma
=> Rails 5.2.0 application starting in development
=> Run `rails server -h` for more startup options


========================================
  Your Yarn packages are out of date!
  Please run `yarn install` to update.
========================================


To disable this check, please add `config.webpacker.check_yarn_integrity = false`
to your Rails development config file (config/environments/development.rb).

おや、yarn installしたはずなのにな、、、??となった。

タイトルの通りDockerflieでは以下のようにする必要があった。

RUN NODE_ENV=development yarn install

もちろんこれは、RAILS_ENV=developmentの時にはこうする必要があるよ、というお話でした。

8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5