Skip to content

Commit 69820be

Browse files
ZZiigguurraattZZiigguurraatt
authored andcommitted
dev.Dockerfile: use cache mounts to speed up rebuilding
1 parent d6b7557 commit 69820be

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

dev.Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ ARG NO_UI
7070
ARG CGO_ENABLED=1
7171

7272
# Install dependencies and install/build lightning-terminal.
73-
RUN apk add --no-cache --update alpine-sdk make \
73+
# Note: When using `docker build`, setting the environmental variable
74+
# `DOCKER_BUILDKIT=1` is required to enable
75+
# [BuildKit](https://docs.docker.com/build/buildkit)
76+
# so that the cache mounts can be used.
77+
RUN --mount=type=cache,target=/go/pkg/mod \
78+
--mount=type=cache,target=/root/.cache/go-build \
79+
apk add --no-cache --update alpine-sdk make \
7480
&& cd /go/src/github.com/lightninglabs/lightning-terminal \
7581
# If a custom lnd version is supplied, force it now.
7682
&& if [ -n "$LND_VERSION" ]; then \

docs/release-notes/release-notes-0.16.0.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@
1717

1818
### Functional Changes/Additions
1919

20+
* `dev.Dockerfile` now uses
21+
[cache mounts](https://docs.docker.com/build/cache/optimize/#use-cache-mounts)
22+
to cache the `GOMODCACHE` and `GOCACHE` directories so that dependencies don't
23+
need to be re-downloaded and re-built every time the image is re-created. This
24+
is particularly useful when the build context is a remote git repo and not a
25+
local filesystem, which often times causes a `COPY` layer cache and all the
26+
subsequent build layer caches to be invalidated. As a result of this change,
27+
`dev.Dockerfile` now requires
28+
[BuildKit](https://docs.docker.com/build/buildkit) to build. When using
29+
`docker build`, this can be enabled by setting the environmental variable
30+
`DOCKER_BUILDKIT=1`.
31+
32+
2033
### Technical and Architectural Updates
2134

2235
## RPC Updates

0 commit comments

Comments
 (0)