From d042fc58106afdd3e182f69d2e3dda409a86477f Mon Sep 17 00:00:00 2001 From: null31 Date: Fri, 21 Aug 2020 12:17:15 -0300 Subject: [PATCH 1/2] Ignore .git and .github directories when run dockerfile copy command. --- .dockerignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9b3407c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +# git directories +.git +.github From 440107e58acab591edc6c72a7de5777ff73be95a Mon Sep 17 00:00:00 2001 From: null31 Date: Fri, 21 Aug 2020 12:35:16 -0300 Subject: [PATCH 2/2] Improved the image creation and reduced final size from 718MB to 241MB. --- Dockerfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6fbd54c..c7d015a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,16 +8,17 @@ WORKDIR /usr/src/lolisafe COPY package.json yarn.lock ./ -RUN apk add --no-cache --virtual build-dependencies python make g++ && apk add --no-cache ffmpeg +RUN apk --no-cache update \ +&& apk add --no-cache --virtual build-dependencies python make g++ \ +&& apk add --no-cache ffmpeg \ +&& apk del build-dependencies \ +&& yarn install --production \ +&& yarn cache clean ADD config.sample.js config.js -RUN yarn install - -RUN apk update - -RUN apk del build-dependencies - COPY . . + EXPOSE 9999 + CMD ["node", "lolisafe.js"]