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.
This commit is contained in:
Yan Pritzker 2019-02-06 15:38:15 -06:00
parent 9cd88a04b7
commit 6addfc7010

@ -2,9 +2,6 @@ FROM golang:1.11-alpine as builder
MAINTAINER Olaoluwa Osuntokun <lightning.engineering>
# 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