Docker For Rails Developers - Chapter 7 Playing Nice With JavaScript - Installing Webpacker

Yarn installation has changed since this book has been written. We no longer need to specify the setup scripts or address the dependency issue mentioned by Rob.

Here is my Dockerfile working with Yarn

FROM ruby:2.6

LABEL maintainer=""

RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends nodejs

RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends apt-transport-https

RUN curl -sS | apt-key add -
RUN echo "deb stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt update -yqq && apt install -f yarn

COPY Gemfile* /usr/src/app/
WORKDIR /usr/src/app
RUN bundle install

COPY . /usr/src/app/

CMD ["bin/rails", "s", "-b", ""]