From 6dfc90d388a2e487dc7b524966de2e9ff34c52b4 Mon Sep 17 00:00:00 2001 From: Sean Lynch Date: Thu, 19 Feb 2015 00:07:12 -0500 Subject: [PATCH] Improve Dockerfile example/test Placing `COPY` (or `ADD`) of the application directory after the `RUN apt-get install ...` statements will allow the layers created from those statements to be retrieved from docker's cache on subsequent runs. --- tests/apps/dockerfile/Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/apps/dockerfile/Dockerfile b/tests/apps/dockerfile/Dockerfile index a229deba3..badf138d9 100644 --- a/tests/apps/dockerfile/Dockerfile +++ b/tests/apps/dockerfile/Dockerfile @@ -4,8 +4,11 @@ ENV DEBIAN_FRONTEND noninteractive ENV DEBCONF_NONINTERACTIVE_SEEN true EXPOSE 5000 -ADD . /app RUN apt-get install -y software-properties-common && add-apt-repository ppa:chris-lea/node.js && apt-get update RUN apt-get install -y build-essential curl postgresql-client-9.3 nodejs git -RUN cd /app && npm install -CMD cd /app && npm start + +COPY . /app +WORKDIR /app +RUN npm install + +CMD npm start