@@ -30,13 +30,35 @@ COPY --from=nodejsbuilder /go/src/github.com/lightninglabs/lightning-terminal /g
3030#  queries required to connect to linked containers succeed.
3131ENV  GODEBUG netdns=cgo
3232
33- #  Allow forcing a specific lnd, taproot-assets, and taprpc version through a
34- #  build argument.
33+ #  Allow forcing a specific lnd, taproot-assets, taprpc, and/or loop repo so that
34+ #  commits referenced by LND_VERSION, TAPROOT_ASSETS_VERSION, TAPRPC_VERSION, and
35+ #  LOOP_VERSION don't have to exist in the default repository. If any of these
36+ #  build arguments are not defined, the build continues using the default
37+ #  repository for that module. NOTE: If these arguments ARE defined then the
38+ #  corresponding `_VERSION` argument MUST also be defined, otherwise the build
39+ #  continues using the default repository defined for that module.
40+ ARG  LND_REPO
41+ ARG  TAPROOT_ASSETS_REPO
42+ ARG  TAPRPC_REPO
43+ ARG  LOOP_REPO
44+ 
45+ #  Allow forcing a specific lnd, taproot-assets, taprpc, and/or loop version
46+ #  through a build argument.
3547#  Please see https://go.dev/ref/mod#version-queries for the types of
3648#  queries that can be used to define a version.
49+ #  If any of these build arguments are not defined then build uses the version
50+ #  already defined in go.mod and go.sum for that module.
51+ #  Note: If the corresponding `_REPO` argument is not defined, `go get` will
52+ #  be used along with `go mod tidy`, which sometimes may change the version you
53+ #  are trying to use because some other module requires the same requirement
54+ #  but of a different version. A trick to overcome this is to also use the
55+ #  `_REPO` argument and just put in the default repository for that module and
56+ #  that will cause a `go mod edit -replace=` to be used instead which won't have
57+ #  this issue.
3758ARG  LND_VERSION
3859ARG  TAPROOT_ASSETS_VERSION
3960ARG  TAPRPC_VERSION
61+ ARG  LOOP_VERSION
4062
4163#  Need to restate this since running in a new container from above.
4264ARG  NO_UI
@@ -46,17 +68,42 @@ RUN apk add --no-cache --update alpine-sdk make \
4668  && cd /go/src/github.com/lightninglabs/lightning-terminal \
4769  #  If a custom lnd version is supplied, force it now.
4870  && if [ -n "$LND_VERSION"  ]; then \
49-     go get -v github.com/lightningnetwork/lnd@$LND_VERSION \
71+     #  If a custom lnd repo is supplied, force it now.
72+     if [ -n "$LND_REPO"  ]; then \
73+       go mod edit -replace=github.com/lightningnetwork/lnd=$LND_REPO@$LND_VERSION; \
74+     else \
75+       go get -v github.com/lightningnetwork/lnd@$LND_VERSION; \
76+     fi \
5077    && go mod tidy; \
5178  fi \
5279  #  If a custom taproot-assets version is supplied, force it now.
5380  && if [ -n "$TAPROOT_ASSETS_VERSION"  ]; then \
54-     go get -v github.com/lightninglabs/taproot-assets@$TAPROOT_ASSETS_VERSION \
81+     #  If a custom taproot-assets repo is supplied, force it now.
82+     if [ -n "$TAPROOT_ASSETS_REPO"  ]; then \
83+       go mod edit -replace=github.com/lightninglabs/taproot-assets=$TAPROOT_ASSETS_REPO@$TAPROOT_ASSETS_VERSION; \
84+     else \
85+       go get -v github.com/lightninglabs/taproot-assets@$TAPROOT_ASSETS_VERSION; \
86+     fi \
5587    && go mod tidy; \
5688  fi \
5789  #  If a custom taprpc version is supplied, force it now.
5890  && if [ -n "$TAPRPC_VERSION"  ]; then \
59-     go get -v github.com/lightninglabs/taproot-assets/taprpc@$TAPRPC_VERSION \
91+     #  If a custom taprpc repo is supplied, force it now.
92+     if [ -n "$TAPRPC_REPO"  ]; then \
93+       go mod edit -replace=github.com/lightninglabs/taproot-assets/taprpc=$TAPRPC_REPO@$TAPRPC_VERSION; \
94+     else \
95+       go get -v github.com/lightninglabs/taproot-assets/taprpc@$TAPRPC_VERSION; \
96+     fi \
97+     && go mod tidy; \
98+   fi \
99+   #  If a custom loop version is supplied, force it now.
100+   && if [ -n "$LOOP_VERSION"  ]; then \
101+     #  If a custom loop repo is supplied, force it now.
102+     if [ -n "$LOOP_REPO"  ]; then \
103+       go mod edit -replace=github.com/lightninglabs/loop=$LOOP_REPO@$LOOP_VERSION; \
104+     else \
105+       go get -v github.com/lightninglabs/loop@$LOOP_VERSION; \
106+     fi \
60107    && go mod tidy; \
61108  fi \
62109  && if [ "$NO_UI"  -eq "1"  ]; then \
0 commit comments