From 3509dd575225c8da1583ed9d3b1cb75fcfc731d6 Mon Sep 17 00:00:00 2001 From: Benjamin LEVESQUE <14175665+benjlevesque@users.noreply.github.com> Date: Thu, 5 Dec 2019 09:29:39 +0100 Subject: [PATCH] chore(CI): optimize docker build (#71) --- .circleci/config.yml | 3 ++- .dockerignore | 7 ++++++- Dockerfile | 14 ++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 477c074b3d..c124359b83 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -434,7 +434,8 @@ jobs: executor: gcp/default steps: - checkout - - setup_remote_docker + - setup_remote_docker: + docker_layer_caching: true - gcp/install - gcp/initialize - run: diff --git a/.dockerignore b/.dockerignore index 2ecb1223e2..acb2190a8e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,8 @@ Dockerfile node_modules -packages/**/node_modules \ No newline at end of file +packages/**/node_modules +.git +.github +.vscode +*.md +.circleci \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4d17e368c3..93bc904954 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,15 @@ FROM node:10-alpine WORKDIR /app +RUN apk add --virtual .build-deps git python g++ bash make + +COPY package.json . +COPY yarn.lock . + +RUN yarn + COPY . . +RUN yarn +RUN yarn build -RUN apk add --no-cache --virtual .build-deps git python g++ bash make && \ - yarn && \ - yarn build && \ - apk del .build-deps +RUN apk del .build-deps