From 0b5b6f80ccde5c5df9e1cffbebc4a7a49f6d8a4d Mon Sep 17 00:00:00 2001 From: sean borg Date: Fri, 7 Jun 2019 09:11:34 +0100 Subject: [PATCH 1/2] Initial docker file --- Dockerfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..11e3b05eb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# specify the node base image with your desired version node: +FROM node:10.1 + +WORKDIR /usr/src/app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +EXPOSE 3000 + +CMD ["npm","run","start"] \ No newline at end of file From 3cb59ca87a4f306625ba9677430c6ae0d4e630e9 Mon Sep 17 00:00:00 2001 From: sean borg Date: Tue, 11 Jun 2019 10:05:37 +0100 Subject: [PATCH 2/2] Update to docker file and readme Updated the docker file to get live reloading to work. Added the comands I ran to get the docker container to work --- Dockerfile | 10 ---------- README.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 11e3b05eb..34dde006d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,4 @@ # specify the node base image with your desired version node: FROM node:10.1 -WORKDIR /usr/src/app - -COPY package*.json ./ - -RUN npm install - -COPY . . - EXPOSE 3000 - -CMD ["npm","run","start"] \ No newline at end of file diff --git a/README.md b/README.md index d5ac018ff..fbf40f923 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,34 @@ npm run build:preview See [package.json](package.json#L8) for all tasks. +## Usage with docker + +### :exclamation: Prerequisites + + +Clone this repository and run: + +```bash +docker build -t mhp . +``` + +This will take some time and will install the correct version of node to run Victor Hugo inside a docker container. + +```bash +sudo docker run -v "$(pwd)":/app -w /app mhp npm install +``` + +This will take some time and will install all packages necessary to run Victor Hugo and its tasks. + +### :construction_worker: Development + +While developing your website, use: +```bash +docker run -v "$(pwd)":/app -w /app --net=host mhp npm run start +``` + +Then visit http://localhost:3000/ to preview your new website. Webpack Dev Server will automatically reload the CSS or refresh the whole page, when stylesheets or content changes. + ## Structure ```