From 890fb68c7c54b43aea23e455963c995fbecbc77a Mon Sep 17 00:00:00 2001 From: Jonathan Zernik Date: Sun, 22 Mar 2020 23:37:02 -0700 Subject: [PATCH] Speed up docker build by caching rpc file downloads. (#12) --- docker/sqkclient/Dockerfile | 9 +++++++++ install-rpc.sh | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docker/sqkclient/Dockerfile b/docker/sqkclient/Dockerfile index 42d9ac23..7d8615cd 100644 --- a/docker/sqkclient/Dockerfile +++ b/docker/sqkclient/Dockerfile @@ -11,8 +11,17 @@ COPY requirements.txt / RUN pip3 install --upgrade pip RUN pip3 install -r requirements.txt +# Download the rpc files. +RUN git clone https://github.com/googleapis/googleapis.git +RUN curl -o rpc.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/rpc.proto +# Copy the source code. COPY . /app + +# Copy the source code. +RUN cp -r googleapis /app +RUN cp rpc.proto /app + WORKDIR /app # Install the gRPC files. diff --git a/install-rpc.sh b/install-rpc.sh index 066d21df..8ac32e75 100755 --- a/install-rpc.sh +++ b/install-rpc.sh @@ -1,7 +1,12 @@ #!/usr/bin/env bash -git clone https://github.com/googleapis/googleapis.git -curl -o rpc.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/rpc.proto +if [ ! -d "googleapis" ]; then + git clone https://github.com/googleapis/googleapis.git +fi + +if [ ! -f "rpc.proto" ]; then + curl -o rpc.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/rpc.proto +fi cp rpc.proto squeaknode/common