From 6addfc7010c4035a741db5d5e5ceb057be8d3e64 Mon Sep 17 00:00:00 2001 From: Yan Pritzker Date: Wed, 6 Feb 2019 15:38:15 -0600 Subject: [PATCH] Add source after installing apk packages Currently, changing the source code causes the docker layer cache to break the caching of package installation (make, git, etc). If we execute the source COPY command as an individual command, then rebuilds of the container will be much quicker. --- docker/lnd/Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docker/lnd/Dockerfile b/docker/lnd/Dockerfile index 42c1ca36..5cb7fd7d 100644 --- a/docker/lnd/Dockerfile +++ b/docker/lnd/Dockerfile @@ -2,9 +2,6 @@ FROM golang:1.11-alpine as builder MAINTAINER Olaoluwa Osuntokun -# Copy in the local repository to build from. -COPY . /go/src/github.com/lightningnetwork/lnd - # Force Go to use the cgo based DNS resolver. This is required to ensure DNS # queries required to connect to linked containers succeed. ENV GODEBUG netdns=cgo @@ -12,8 +9,12 @@ ENV GODEBUG netdns=cgo # Install dependencies and install/build lnd. RUN apk add --no-cache --update alpine-sdk \ git \ - make \ -&& cd /go/src/github.com/lightningnetwork/lnd \ + make + +# Copy in the local repository to build from. +COPY . /go/src/github.com/lightningnetwork/lnd + +RUN cd /go/src/github.com/lightningnetwork/lnd \ && make \ && make install