mirror of
https://github.com/lightningnetwork/lnd.git
synced 2026-08-13 12:32:48 +02:00
dev.Dockerfile: use cache mounts to speed up rebuilding
This commit is contained in:
parent
1f23a119d0
commit
20e651869c
2 changed files with 18 additions and 1 deletions
|
|
@ -18,7 +18,13 @@ RUN apk add --no-cache --update alpine-sdk \
|
|||
COPY . /go/src/github.com/lightningnetwork/lnd
|
||||
|
||||
# Install/build lnd.
|
||||
RUN cd /go/src/github.com/lightningnetwork/lnd \
|
||||
# Note: When using `docker build`, setting the environmental variable
|
||||
# `DOCKER_BUILDKIT=1` is required to enable
|
||||
# [BuildKit](https://docs.docker.com/build/buildkit)
|
||||
# so that the cache mounts can be used.
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
cd /go/src/github.com/lightningnetwork/lnd \
|
||||
&& make \
|
||||
&& make install-all tags="signrpc walletrpc chainrpc invoicesrpc peersrpc kvdb_sqlite"
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,17 @@
|
|||
|
||||
## Tooling and Documentation
|
||||
|
||||
* [`dev.Dockerfile` now uses](https://github.com/lightningnetwork/lnd/pull/10903)
|
||||
[cache mounts](https://docs.docker.com/build/cache/optimize/#use-cache-mounts)
|
||||
to cache the `GOMODCACHE` and `GOCACHE` directories so that dependencies don't
|
||||
need to be re-downloaded and re-built every time the image is re-created.
|
||||
As a result of this change, `dev.Dockerfile` now requires
|
||||
[BuildKit](https://docs.docker.com/build/buildkit) to build. When using
|
||||
`docker build`, this can be enabled by setting the environmental variable
|
||||
`DOCKER_BUILDKIT=1`. BuildKit also does not unnecessarily rebuild images when
|
||||
the build context is a remote git repository because COPY layers are more
|
||||
smartly compared to cache.
|
||||
|
||||
# Contributors (Alphabetical Order)
|
||||
|
||||
* bitromortac
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue