Quick Recap
Let’s review what we covered.
We'll cover the following
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:
-
We added a default command to our image using the
CMD
instruction:CMD ["bin/rails", "s", "-b", "0.0.0.0"]
-
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. -
We ensured that we always use up-to-date package repository information when altering the packages we install by combining
apt-get update
andapt- get install
into a singleRUN
instruction:RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \ nodejs
-
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
-
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 1400+ tech skills courses.