edruder
Docker for Rails Developers: Notes for Rails 6.1, Ruby 2.7.2
I thought that there might be interest in using the book with Rails 6.1 and Ruby 2.7.2. I’ll note what I needed to do differently here.
- p. 11
rails new myapp --skip-test. Do not add the--skip-bundleflag–it causes several steps of thenewcommand to fail. (Notably,webpacker:installdoesn’t occur.) - p. 19 Update the
Dockerfileto get a newer version of Ruby, a recent version ofyarn, and set upwebpacker:FROM ruby:2.7.2 # Ensure latest packages for Yarn RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=true 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 -yqq RUN apt-get install -yqq --no-install-recommends nodejs yarn WORKDIR /usr/src/app COPY . . RUN bundle install RUN yarn install - p. 40 Modified
DockerfileafterThe Gemfile Caching Trick:FROM ruby:2.7.2 # Ensure latest packages for Yarn RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=true apt-key add - && \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ apt-get update -yqq && apt-get install -yqq --no-install-recommends \ nodejs \ yarn WORKDIR /usr/src/app COPY Gemfile* ./ RUN bundle install RUN yarn install COPY . . CMD ["bin/rails", "s", "-b", "0.0.0.0"] - p. 88 In
Rails JavaScript Front End with Webpacker, nothing needs to be done to installwebpacker, since we installed it at the beginning. (There is no issue with the version ofnode, either. In fact, running thecurlto get an “up-to-date” version ends up installing a deprecated version.) You do need to install thewebpackerReact integration, though–docker-compose run web bin/rails webpacker:install:react. - p. 96
Setting Up RSpec, grab a newer version of RSpec–gem 'rspec-rails', '~> 4.0.1'–per therspec-railsinstallation instructions. - p. 96-97 I had to
stop,build, andup -d --force-recreatethewebpack_dev_serverafter doing the same forweb, after installing RSpec. - p. 100
gem 'capybara', '~> 3.34'
Most Liked
edruder
- p. 146 With Rails 6, there’s a new way to handle secrets. Instead of defining
SECRET_KEY_BASE, you’ll need to defineRAILS_MASTER_KEY.- Run
bin/rails credentials:editand save the result. This will create the value of an encryption key inconfig/master.keyand an encrypted secrets file inconfig/credentials.yml.enc. - Copy the value of the encryption key in
config/master.keyto theRAILS_MASTER_KEYenvironment variable in.env/production/web. (SECRET_KEY_BASEis obsolete–don’t define it.)
- Run
3
Popular Pragmatic Bookshelf topics
In Chapter 3, the source for index introduces Config on page 31, followed by more code including tests; Config isn’t introduced until pag...
New
page 37
ANTLRInputStream input = new ANTLRInputStream(is);
as of ANTLR 4 .8 should be:
CharStream stream = CharStreams.fromStream(i...
New
Python Testing With Pytest - Chapter 2, warnings for “unregistered custom marks”
While running the smoke tests in Chapter 2, I get these...
New
Hello! On page xix of the preface, it says there is a community forum "… for help if your’re stuck on one of the exercises in this book… ...
New
First, the code resources:
Page 237: rumbl_umbrella/apps/rumbl/mix.exs
Note: That this file is missing.
Page 238: rumbl_umbrella/app...
New
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
New
Hi all,
currently I wonder how the Tailwind colours work (or don’t work).
For example, in app/views/layouts/application.html.erb I have...
New
Hi, I’ve got a question about the implementation of PubSub when using a Phoenix.Socket.Transport behaviour rather than channels.
Before ...
New
Title: Agile Web Development with Rails 7: (page 70)
I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
New
root_layout: {PentoWeb.LayoutView, :root},
This results in the following following error:
no “root” html template defined for PentoWeb...
New
Other popular topics
Which, if any, games do you play? On what platform?
I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
Design and develop sophisticated 2D games that are as much fun to make as they are to play. From particle effects and pathfinding to soci...
New
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
New
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me.
I think the Planck and the Preonic (o...
New
Saw this on TikTok of all places! :lol:
Anyone heard of them before?
Lite:
New
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
The File System Access API with Origin Private File System.
WebKit supports new API that makes it possible for web apps to create, open,...
New
Was just curious to see if any were around, found this one:
I got 51/100:
Not sure if it was meant to buy I am sure at times the b...
New
Ask Me Anything with
Mark Volkmann
@mvolkmann
On February 24 and 25, we are giving you a chance to ask questions of PragProg author M...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /python
- /js
- /rails
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /centos
- /php
- /deepseek
- /zig
- /scala
- /textmate
- /sublime-text
- /lisp
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /deno
- /django
- /revery
- /ubuntu
- /nodejs
- /manjaro
- /spring
- /diversity
- /lua
- /julia
- /slackware
- /c







