Travis

Travis

Docker For Rails Developers - Chapter 2 Defining Our First Custom Image WORKDIR Correctoin

Dockerfile:

FROM ruby:2.6

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

COPY . /usr/src/app/

WORKDIR /usr/src/app/

RUN bundle install

The Dockerfile instructs us to copy the current directory into /usr/src/app/. Placing our directory myapp into /usr/src/app/.

Then the WORKDIR is defined as /usr/src/app/

And RUN bundle install.

This fails as bundle install should be run in the app directory. We’re in /usr/src/app/ but we should be in /usr/src/app/myapp.

The Dockerfile is corrected with

FROM ruby:2.6

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

COPY . /usr/src/app/

WORKDIR /usr/src/app/myapp

RUN bundle install

Most Liked

Travis

Travis

I ended up with a different solution and believe my original problem was a wrong file structure.

My Dockerfile is now located in the Rails app - myapp. The value of WORKDIR is /usr/src/app/.

Is that how you have yours now?

jetsondavis

jetsondavis

I made the change you suggest, now get this:
/usr/local/bundle/gems/webpacker-4.3.0/lib/webpacker/configuration.rb:95:in `rescue in load’: Webpacker configuration file not found /usr/src/app/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /usr/src/app/config/webpacker.yml (RuntimeError)

Can anyone help? Frustrating to pay so much for a book that is incorrect.

edruder

edruder

  • myapp should be your current directory. (cd myapp)
  • The Dockerfile should be created in the myapp directory–it looks like you created it one directory above.
  • docker build . will then succeed, I think.

Where Next?

Popular Pragmatic Bookshelf topics Top

abtin
page 20: … protoc command… I had to additionally run the following go get commands in order to be able to compile protobuf code using go...
New
New
brianokken
Many tasks_proj/tests directories exist in chapters 2, 3, 5 that have tests that use the custom markers smoke and get, which are not decl...
New
lirux
Hi Jamis, I think there’s an issue with a test on chapter 6. I own the ebook, version P1.0 Feb. 2019. This test doesn’t pass for me: ...
New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
New
rmurray10127
Title: Intuitive Python: docker run… denied error (page 2) Attempted to run the docker command in both CLI and Powershell PS C:\Users\r...
New
jskubick
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
jskubick
I found an issue in Chapter 7 regarding android:backgroundTint vs app:backgroundTint. How to replicate: load chapter-7 from zipfile i...
New
rainforest
Hi, I’ve got a question about the implementation of PubSub when using a Phoenix.Socket.Transport behaviour rather than channels. Before ...
New
dachristenson
I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20: “Update activity...
New

Other popular topics Top

AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
brentjanderson
Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
AstonJ
Inspired by this post from @Carter, which languages, frameworks or other tech or tools do you think is killing it right now? :upside_down...
New
Exadra37
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
New
New
PragmaticBookshelf
Author Spotlight: Peter Ullrich @PJUllrich Data is at the core of every business, but it is useless if nobody can access and analyze ...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New

Sub Categories: