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
Working through the steps (checking that the Info,plist matches exactly), run the demo game and what appears is grey but does not fill th...
New
Title: Web Development with Clojure, Third Edition, pg 116
Hi - I just started chapter 5 and I am stuck on page 116 while trying to star...
New
Hi,
build fails on:
bracket-lib = “~0.8.1”
when running on Mac Mini M1 Rust version 1.5.0:
Compiling winit v0.22.2
error[E0308]: mi...
New
Page 28: It implements io.ReaderAt on the store type.
Sorry if it’s a dumb question but was the io.ReaderAt supposed to be io.ReadAt?
...
New
@noelrappin
Running the webpack dev server, I receive the following warning:
ERROR in tsconfig.json
TS18003: No inputs were found in c...
New
I’m running Android Studio “Arctic Fox” 2020.3.1 Patch 2, and I’m embarrassed to admit that I only made it to page 8 before running into ...
New
This is as much a suggestion as a question, as a note for others.
Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint.
As entered, the SwitchCompat changes color to hol...
New
It seems the second code snippet is missing the code to set the current_user:
current_user: Accounts.get_user_by_session_token(session["...
New
Skimming ahead, much of the following is explained in Chapter 3, but new readers (like me!) will hit a roadblock in Chapter 2 with their ...
New
Other popular topics
A thread that every forum needs!
Simply post a link to a track on YouTube (or SoundCloud or Vimeo amongst others!) on a separate line an...
New
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
I’ve been really enjoying obsidian.md:
It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
New
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
The V Programming Language
Simple language for building maintainable programs
V is already mentioned couple of times in the forum, but I...
New
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol:
bre...
New
Author Spotlight
Dmitry Zinoviev
@aqsaqal
Today we’re putting our spotlight on Dmitry Zinoviev, author of Data Science Essentials in ...
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
A Brief Review of the Minisforum V3 AMD Tablet.
Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /rails
- /python
- /js
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /opensuse
- /html
- /centos
- /php
- /zig
- /deepseek
- /scala
- /textmate
- /sublime-text
- /lisp
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /revery
- /ubuntu
- /spring
- /manjaro
- /deno
- /nodejs
- /diversity
- /lua
- /julia
- /slackware
- /c






