From 5a50f1592633639ead4a8eeddd70e838f9c9a296 Mon Sep 17 00:00:00 2001 From: azban Date: Thu, 1 Nov 2018 01:47:08 -0700 Subject: [PATCH] improve docker build caching (#1045) * docker: add Dockerfile and .dockerignore to .dockerignore * docker: install cargo deps before copying code --- substrate/.dockerignore | 2 ++ substrate/Dockerfile | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/substrate/.dockerignore b/substrate/.dockerignore index 2b0e81eaf0..fd7da032ab 100644 --- a/substrate/.dockerignore +++ b/substrate/.dockerignore @@ -1,2 +1,4 @@ doc target +Dockerfile +.dockerignore diff --git a/substrate/Dockerfile b/substrate/Dockerfile index 87c33c859f..0388c7298a 100644 --- a/substrate/Dockerfile +++ b/substrate/Dockerfile @@ -5,15 +5,15 @@ LABEL description="This is the build stage for Substrate. Here we create the bin ARG PROFILE=release WORKDIR /substrate -COPY . /substrate - RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y cmake pkg-config libssl-dev git -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \ - export PATH=$PATH:$HOME/.cargo/bin && \ - cargo build --$PROFILE +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y + +COPY . /substrate + +RUN export PATH=$PATH:$HOME/.cargo/bin && cargo build --$PROFILE # ===== SECOND STAGE ======