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="myemail@email.com"
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 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 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", "0.0.0.0"]