Quick Recap

Let’s review what we covered.

Highlights

Our Dockerfile scrubs up pretty well. You can put the wrench down, take off those oil-stained overalls, and put your feet up again, metaphorically speaking. You deserve it!

Let’s review what we covered:

  1. We added a default command to our image using the CMD instruction:

    CMD ["bin/rails", "s", "-b", "0.0.0.0"] 
    
  2. We sped up our image builds by using a .dockerignore to prevent unnecessary files from being sent to the Docker daemon as part of our build context.

  3. We ensured that we always use up-to-date package repository information when altering the packages we install by combining apt-get update and apt- get install into a single RUN instruction:

    RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \ 
    nodejs 
    
  4. We prevented file changes from causing our gems to be rebuilt by copying our Gemfiles earlier in our Dockerfile so they could be cached separately:

    COPY myapp/Gemfile* /usr/src/app/ 
    WORKDIR /usr/src/app 
    RUN bundle install 
    
  5. Finally, we indicated who was responsible for our image by setting a maintainer with the LABEL instruction.

Not bad for a day’s work. 💫

What to expect in the next chapter?

If you thought using Docker for development could not get any better or perhaps still have some reservations, brace yourselves. Up next, we will discover an even more powerful tool that will supercharge our development. Onward!

Get hands-on with 1200+ tech skills courses.