Docker上でrails6の環境を構築していたところ、Webpackerのインストールにはyarnとnodeのインストールが必要という事でインストールを試みるも
% docker-compose run web bundle exec rails webpacker:install Creating network "myapp_default" with the default driver Creating myapp_db_1 ... done Creating myapp_web_run ... done Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/
yarnがインストールされていないと表示されます。
https://qiita.com/NaokiIshimura/items/8203f74f8dfd5f6b87a0
https://qiita.com/kodai_0122/items/795438d738386c2c1966
これらの記事を参考に
Dockerfile
1FROM ruby:2.6.5 2RUN apt-get update -qq && apt-get install -y nodejs postgresql-client 3RUN apt-get update && apt-get install -y curl apt-transport-https wget && \ 4curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ 5echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ 6apt-get update && apt-get install -y yarn 7RUN curl -sL https://deb.nodesource.com/setup_7.x | bash - && \ 8apt-get install nodejs
や
Dockerfile
1FROM ruby:2.6.5 2RUN curl https://deb.nodesource.com/setup_12.x | bash 3RUN curl https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - 4RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list 5 6RUN apt-get update && apt-get install -y nodejs yarn postgresql-clientRUN mkdir /myapp 7WORKDIR /myapp 8COPY Gemfile /myapp/Gemfile 9COPY Gemfile.lock /myapp/Gemfile.lock 10RUN bundle install 11COPY . /myapp 12 13# Add a script to be executed every time the container starts. 14COPY entrypoint.sh /usr/bin/ 15RUN chmod +x /usr/bin/entrypoint.sh 16ENTRYPOINT ["entrypoint.sh"] 17EXPOSE 3000 18 19# Start the main process. 20CMD ["rails", "server", "-b", "0.0.0.0"] 21
など試しましたがエラーが解消されません。
理由・解決方法わかる方いらっしゃいましたらお願い致します。
あなたの回答
tips
プレビュー