From 057bcc889a14d8a1fb02dba928952df7fc28970f Mon Sep 17 00:00:00 2001 From: Hitesh Kumar <37622734+HeroicHitesh@users.noreply.github.com> Date: Tue, 26 May 2020 22:31:20 +0530 Subject: [PATCH 1/4] Avoid npm install on every docker build --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dockerfile b/Dockerfile index d7a5a46..0a3fa15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,11 @@ RUN wget -qO- "https://github.com/dustinblackman/phantomized/releases/download/2 # Add fonts required by phantomjs to render html correctly RUN apk add --update ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu-font-family && rm -rf /var/cache/apk/* +# Avoids npm install phase on every docker build +COPY package.json /tmp/package.json +RUN cd /tmp && npm install +RUN mkdir -p /usr/src/certificate-worker && cp -a /tmp/node_modules /usr/src/certificate-worker/ + WORKDIR /usr/src/certificate-worker COPY package.json ./ From df552e2b0a87295f900ba298e76253de79eb4b8b Mon Sep 17 00:00:00 2001 From: Hitesh Kumar <37622734+HeroicHitesh@users.noreply.github.com> Date: Wed, 27 May 2020 10:15:08 +0530 Subject: [PATCH 2/4] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0a3fa15..4e1dd78 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ RUN mkdir -p /usr/src/certificate-worker && cp -a /tmp/node_modules /usr/src/cer WORKDIR /usr/src/certificate-worker -COPY package.json ./ +COPY package.json /usr/src/certificate-worker COPY yarn.lock ./ COPY src ./src From 20cb4e33edf9bdec821a1944c1d153e94257a475 Mon Sep 17 00:00:00 2001 From: Hitesh Kumar <37622734+HeroicHitesh@users.noreply.github.com> Date: Wed, 27 May 2020 10:15:33 +0530 Subject: [PATCH 3/4] Update Dockerfile --- Dockerfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4e1dd78..0f8b737 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,11 +11,6 @@ RUN wget -qO- "https://github.com/dustinblackman/phantomized/releases/download/2 # Add fonts required by phantomjs to render html correctly RUN apk add --update ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu-font-family && rm -rf /var/cache/apk/* -# Avoids npm install phase on every docker build -COPY package.json /tmp/package.json -RUN cd /tmp && npm install -RUN mkdir -p /usr/src/certificate-worker && cp -a /tmp/node_modules /usr/src/certificate-worker/ - WORKDIR /usr/src/certificate-worker COPY package.json /usr/src/certificate-worker From 95a6228315795c521d2d74d89bbd6cb5dc483cba Mon Sep 17 00:00:00 2001 From: Hitesh Kumar <37622734+HeroicHitesh@users.noreply.github.com> Date: Wed, 27 May 2020 16:09:21 +0530 Subject: [PATCH 4/4] swap line 18 and 20 --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0f8b737..5eff46a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,11 +13,12 @@ RUN apk add --update ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu WORKDIR /usr/src/certificate-worker -COPY package.json /usr/src/certificate-worker +COPY package.json ./ COPY yarn.lock ./ -COPY src ./src RUN yarn install --pure-lockfile +COPY src ./src + CMD ["yarn", "start"]