I should have put yarn in Docker, but when I hit the command below, I got angry
Contents of Dockerfile
FROM ruby:2.5
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
nodejs \
postgresql-client \
yarn
WORKDIR /kosare
COPY Gemfile Gemfile.lock /kosare/
RUN bundle install
Error occurred in yarn command
root@5847e387581e:/kosare# yarn -v
ERROR: There are no scenarios; must have at least one.
Basically, if you do the same as the URL described in the reference, it will be solved.
In my case, it was already entered as root, so I removed the part that says sudo
and executed it in order to solve it.
sudo apt remove cmdtest
sudo apt remove yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
update
apt-get update
apt-get install yarn
yarn -v
With the above method, the same thing happens again when bundle install is done again with docker. I want to solve it when building with Dockerfile, so add the following two lines to dockerfile.
RUN curl https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
Dockerfile (final form)
FROM ruby:2.5
RUN curl https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
nodejs \
postgresql-client \
yarn
WORKDIR /kosare
COPY Gemfile Gemfile.lock /kosare/
RUN bundle install
If you rebuild it with this, yarn should be usable properly.
https://k-koh.hatenablog.com/entry/2020/04/02/143017 https://github.com/yarnpkg/yarn/issues/7329 https://qiita.com/MasatoraAtarashi/items/3f0317cd648ff63fa92c
Recommended Posts