dev.Dockerfile: use cache mounts to speed up rebuilding

This commit is contained in:
ZZiigguurraatt 2025-10-26 23:44:17 -04:00 committed by ZZiigguurraatt
parent 1ed66620ec
commit 3d9436ec78
2 changed files with 19 additions and 1 deletions

View file

@ -70,7 +70,13 @@ ARG NO_UI
ARG CGO_ENABLED=1
# Install dependencies and install/build lightning-terminal.
RUN apk add --no-cache --update alpine-sdk make \
# 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 \
apk add --no-cache --update alpine-sdk make \
&& cd /go/src/github.com/lightninglabs/lightning-terminal \
# If a custom lnd version is supplied, force it now.
&& if [ -n "$LND_VERSION" ]; then \

View file

@ -17,6 +17,18 @@
### Functional Changes/Additions
* [`dev.Dockerfile` now uses](https://github.com/lightninglabs/lightning-terminal/pull/1168)
[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.
### Technical and Architectural Updates
## RPC Updates