From 2245fc109e6c8e75bcc9a0694a4fd54d1f5632dc Mon Sep 17 00:00:00 2001 From: Victim <94010769+anothervictimofsurvivalinstinct@users.noreply.github.com> Date: Thu, 30 Jun 2022 10:52:58 -0600 Subject: [PATCH 1/3] Added temporary docker - working on multistage --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..3b119850 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:16-alpine3.15 AS build + +WORKDIR /usr/src/app + +COPY . . + +RUN npm install + +ENTRYPOINT npm start From af124fe911cd85da0ff7e249fc4a4a6676b2d072 Mon Sep 17 00:00:00 2001 From: Victim <94010769+anothervictimofsurvivalinstinct@users.noreply.github.com> Date: Thu, 30 Jun 2022 11:19:01 -0600 Subject: [PATCH 2/3] Reduced image size from 967MB to 402MB with multistage build --- Dockerfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3b119850..3c459d5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,16 @@ FROM node:16-alpine3.15 AS build WORKDIR /usr/src/app -COPY . . +COPY package.json . RUN npm install +FROM node:16-alpine3.15 + +WORKDIR /usr/src/app + +COPY . . + +COPY --from=build /usr/src/app /usr/src/app + ENTRYPOINT npm start From 92ca306b782ecb988e7065414099da185b19d8dd Mon Sep 17 00:00:00 2001 From: Victim <94010769+anothervictimofsurvivalinstinct@users.noreply.github.com> Date: Thu, 30 Jun 2022 11:23:24 -0600 Subject: [PATCH 3/3] Update README with docker instructions --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index d74b0526..05f9b264 100644 --- a/README.md +++ b/README.md @@ -76,3 +76,10 @@ Install node.js * $ cd \ * $ npm install * $ npm start + +Docker install + +* $ cd \ +* $ docker build -t jsketcher . +* $ docker run --name=jsketcher -d -p 3000:3000 jsketcher +