From 5953877760bd58fc1ce84e8efd5c4c35aff6f62f Mon Sep 17 00:00:00 2001 From: viveksharmaui Date: Sat, 14 Sep 2019 21:50:04 +0500 Subject: [PATCH 1/3] dockerFile --- dockerFile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 dockerFile diff --git a/dockerFile b/dockerFile new file mode 100644 index 000000000..59e3d2b10 --- /dev/null +++ b/dockerFile @@ -0,0 +1,19 @@ +# Pull base image. +FROM ubuntu + +# Update image +RUN apt-get update + +# Install Node.js +RUN apt-get install --yes curl +RUN curl --silent --location https://deb.nodesource.com/setup_10.x | bash - +RUN apt-get install --yes nodejs + +# Bundle app source +COPY . /usr/src/app + +# Install app dependencies +RUN cd /usr/src/app; npm install && npm audit fix + +# These commands unlike RUN (they are carried out in the construction of the container) are run when the container +CMD ["npm", "start"] \ No newline at end of file From 3aa47a2684e78b276bcee7bfc860f95d06e80cf0 Mon Sep 17 00:00:00 2001 From: viveksharmaui Date: Sat, 14 Sep 2019 21:55:16 +0500 Subject: [PATCH 2/3] work dir --- dockerFile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockerFile b/dockerFile index 59e3d2b10..3df229388 100644 --- a/dockerFile +++ b/dockerFile @@ -1,6 +1,9 @@ # Pull base image. FROM ubuntu +# Set the working directory to /usr/src/app +WORKDIR /usr/src/app + # Update image RUN apt-get update From c7345db4ed679ba35c04da581f21cb08c2e6f552 Mon Sep 17 00:00:00 2001 From: viveksharmaui Date: Sat, 14 Sep 2019 21:58:20 +0500 Subject: [PATCH 3/3] dockerFile --- dockerFile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dockerFile b/dockerFile index 3df229388..272e624e4 100644 --- a/dockerFile +++ b/dockerFile @@ -1,9 +1,6 @@ # Pull base image. FROM ubuntu -# Set the working directory to /usr/src/app -WORKDIR /usr/src/app - # Update image RUN apt-get update @@ -12,11 +9,18 @@ RUN apt-get install --yes curl RUN curl --silent --location https://deb.nodesource.com/setup_10.x | bash - RUN apt-get install --yes nodejs +# Set the working directory to /usr/src/app +WORKDIR /usr/src/app + +# Install app dependencies +# A wildcard is used to ensure both package.json AND package-lock.json are copied where available (npm@5+) +COPY package*.json ./ + # Bundle app source -COPY . /usr/src/app +COPY . ./ # Install app dependencies -RUN cd /usr/src/app; npm install && npm audit fix +RUN npm install && npm audit fix # These commands unlike RUN (they are carried out in the construction of the container) are run when the container CMD ["npm", "start"] \ No newline at end of file