Skip to content

dev.Dockerfile: allow skipping build of the web UI #1067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ZZiigguurraatt
Copy link

We now run make go-install-noui and make go-install-cli-noui when
the NO_UI build arg is set to 1 to skip building of the web UI when
using the development docker container. If the NO_UI build arg is not
set, make go-install and make go-install-cli are run as before the
NO_UI build arg existed.

The Makefile also had to be slightly modified to support this feature.

This feature allows quicker rebuilding when using docker if you aren't doing anything with the web UI.

Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks. Just one request.

@ZZiigguurraatt ZZiigguurraatt force-pushed the dev_Dockerfile_no_UI branch 2 times, most recently from 11e8907 to 2f1ac9f Compare May 7, 2025 18:44
We now run `make go-install-noui` and `make go-install-cli-noui` when
the `NO_UI` build arg is set to 1 to skip building of the web UI when
using the development docker container. If the `NO_UI` build arg is not
set, `make go-install` and `make go-install-cli` are run as before the
`NO_UI` build arg existed.
@ZZiigguurraatt ZZiigguurraatt force-pushed the dev_Dockerfile_no_UI branch from 2f1ac9f to ac37b67 Compare May 7, 2025 18:49
@ZZiigguurraatt
Copy link
Author

fixed some bugs

@ZZiigguurraatt
Copy link
Author

OK, everything works, but there is one really weird thing. It is about 11% faster if I build with the UI !

With UI

$ docker compose build --no-cache litd_base
[+] Building 392.3s (23/23) FINISHED                                                                                                                                                                docker:default
 => [litd_base internal] load build definition from dev.Dockerfile                                                                                                                                            0.0s
 => => transferring dockerfile: 36B                                                                                                                                                                           0.0s
 => [litd_base internal] load .dockerignore                                                                                                                                                                   0.0s
 => => transferring context: 34B                                                                                                                                                                              0.0s
 => [litd_base internal] load metadata for docker.io/library/alpine:3.20.3@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d                                                            0.3s
 => [litd_base internal] load metadata for docker.io/library/golang:1.23.6-alpine@sha256:f8113c4b13e2a8b3a168dceaee88ac27743cc84e959f43b9dbd2291e9c3f57a0                                                     0.3s
 => [litd_base internal] load metadata for docker.io/library/node:22.8.0-alpine@sha256:bec0ea49c2333c429b62e74e91f8ba1201b060110745c3a12ff957cd51b363c6                                                       0.3s
 => [litd_base internal] load build context                                                                                                                                                                   0.1s
 => => transferring context: 44.39kB                                                                                                                                                                          0.0s
 => CACHED [litd_base nodejsbuilder 1/4] FROM docker.io/library/node:22.8.0-alpine@sha256:bec0ea49c2333c429b62e74e91f8ba1201b060110745c3a12ff957cd51b363c6                                                    0.0s
 => CACHED [litd_base final 1/9] FROM docker.io/library/alpine:3.20.3@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d                                                                 0.0s
 => => resolve docker.io/library/alpine:3.20.3@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d                                                                                        0.0s
 => CACHED [litd_base golangbuilder 1/3] FROM docker.io/library/golang:1.23.6-alpine@sha256:f8113c4b13e2a8b3a168dceaee88ac27743cc84e959f43b9dbd2291e9c3f57a0                                                  0.0s
 => [litd_base nodejsbuilder 2/4] RUN apk add --no-cache --update git                                                                                                                                         0.9s
 => [litd_base nodejsbuilder 3/4] COPY . /go/src/github.com/lightninglabs/lightning-terminal                                                                                                                  0.3s 
 => [litd_base nodejsbuilder 4/4] RUN cd /go/src/github.com/lightninglabs/lightning-terminal/app   && if [ "0" -eq "1" ]; then     echo "skipping UI build";  else     yarn install     && yarn build;   fi  94.8s 
 => [litd_base golangbuilder 2/3] COPY --from=nodejsbuilder /go/src/github.com/lightninglabs/lightning-terminal /go/src/github.com/lightninglabs/lightning-terminal                                           6.9s 
 => [litd_base golangbuilder 3/3] RUN apk add --no-cache --update alpine-sdk make   && cd /go/src/github.com/lightninglabs/lightning-terminal   && if [ -n "$TAPROOT_ASSETS_VERSION" ]; then     go get -v  274.2s 
 => [litd_base final 2/9] COPY --from=golangbuilder /go/bin/litd /bin/                                                                                                                                        0.1s 
 => [litd_base final 3/9] COPY --from=golangbuilder /go/bin/litcli /bin/                                                                                                                                      0.1s 
 => [litd_base final 4/9] COPY --from=golangbuilder /go/bin/lncli /bin/                                                                                                                                       0.1s 
 => [litd_base final 5/9] COPY --from=golangbuilder /go/bin/frcli /bin/                                                                                                                                       0.1s 
 => [litd_base final 6/9] COPY --from=golangbuilder /go/bin/loop /bin/                                                                                                                                        0.1s 
 => [litd_base final 7/9] COPY --from=golangbuilder /go/bin/pool /bin/                                                                                                                                        0.1s 
 => [litd_base final 8/9] COPY --from=golangbuilder /go/bin/tapcli /bin/                                                                                                                                      0.1s
 => [litd_base final 9/9] RUN apk add --no-cache   bash   jq   ca-certificates                                                                                                                                0.9s
 => [litd_base] exporting to image                                                                                                                                                                            0.7s
 => => exporting layers                                                                                                                                                                                       0.7s
 => => writing image sha256:a1a21b0812ab4794647359038e4b4b11c80ea9f6107187ba63f8fbe7b9caf7f9                                                                                                                  0.0s 
 => => naming to docker.io/library/litd_base_image                                                                  

Without UI

$ docker compose build --no-cache litd_base
[+] Building 438.8s (23/23) FINISHED                                                                                                                                                                docker:default
 => [litd_base internal] load build definition from dev.Dockerfile                                                                                                                                            0.0s
 => => transferring dockerfile: 3.03kB                                                                                                                                                                        0.0s
 => [litd_base internal] load .dockerignore                                                                                                                                                                   0.0s
 => => transferring context: 34B                                                                                                                                                                              0.0s
 => [litd_base internal] load metadata for docker.io/library/alpine:3.20.3@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d                                                            0.0s
 => [litd_base internal] load metadata for docker.io/library/node:22.8.0-alpine@sha256:bec0ea49c2333c429b62e74e91f8ba1201b060110745c3a12ff957cd51b363c6                                                       0.0s
 => [litd_base internal] load metadata for docker.io/library/golang:1.23.6-alpine@sha256:f8113c4b13e2a8b3a168dceaee88ac27743cc84e959f43b9dbd2291e9c3f57a0                                                     0.0s
 => [litd_base internal] load build context                                                                                                                                                                   0.1s
 => => transferring context: 47.40kB                                                                                                                                                                          0.0s
 => CACHED [litd_base final 1/9] FROM docker.io/library/alpine:3.20.3@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d                                                                 0.0s
 => => resolve docker.io/library/alpine:3.20.3@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d                                                                                        0.0s
 => CACHED [litd_base golangbuilder 1/3] FROM docker.io/library/golang:1.23.6-alpine@sha256:f8113c4b13e2a8b3a168dceaee88ac27743cc84e959f43b9dbd2291e9c3f57a0                                                  0.0s
 => CACHED [litd_base nodejsbuilder 1/4] FROM docker.io/library/node:22.8.0-alpine@sha256:bec0ea49c2333c429b62e74e91f8ba1201b060110745c3a12ff957cd51b363c6                                                    0.0s
 => [litd_base nodejsbuilder 2/4] RUN apk add --no-cache --update git                                                                                                                                         1.1s
 => [litd_base nodejsbuilder 3/4] COPY . /go/src/github.com/lightninglabs/lightning-terminal                                                                                                                  0.3s 
 => [litd_base nodejsbuilder 4/4] RUN cd /go/src/github.com/lightninglabs/lightning-terminal/app   && if [ "1" -eq "1" ]; then     echo "skipping UI build";  else     yarn install     && yarn build;   fi   0.1s 
 => [litd_base golangbuilder 2/3] COPY --from=nodejsbuilder /go/src/github.com/lightninglabs/lightning-terminal /go/src/github.com/lightninglabs/lightning-terminal                                           0.1s 
 => [litd_base golangbuilder 3/3] RUN apk add --no-cache --update alpine-sdk make   && cd /go/src/github.com/lightninglabs/lightning-terminal   && if [ -n "$TAPROOT_ASSETS_VERSION" ]; then     go get -v  432.9s 
 => [litd_base final 2/9] COPY --from=golangbuilder /go/bin/litd /bin/                                                                                                                                        0.2s 
 => [litd_base final 3/9] COPY --from=golangbuilder /go/bin/litcli /bin/                                                                                                                                      0.1s 
 => [litd_base final 4/9] COPY --from=golangbuilder /go/bin/lncli /bin/                                                                                                                                       0.1s 
 => [litd_base final 5/9] COPY --from=golangbuilder /go/bin/frcli /bin/                                                                                                                                       0.1s 
 => [litd_base final 6/9] COPY --from=golangbuilder /go/bin/loop /bin/                                                                                                                                        0.1s 
 => [litd_base final 7/9] COPY --from=golangbuilder /go/bin/pool /bin/                                                                                                                                        0.1s 
 => [litd_base final 8/9] COPY --from=golangbuilder /go/bin/tapcli /bin/                                                                                                                                      0.1s
 => [litd_base final 9/9] RUN apk add --no-cache   bash   jq   ca-certificates                                                                                                                                0.7s
 => [litd_base] exporting to image                                                                                                                                                                            0.8s
 => => exporting layers                                                                                                                                                                                       0.8s
 => => writing image sha256:c2f7cff1b79b0ca967057686d521c8d768543bbbe051f4060f8c8c2d12a14af7                                                                                                                  0.0s 
 => => naming to docker.io/library/litd_base_image                                                                       

You can see with UI it takes an extra 94.8 seconds to run yarn install && yarn build but make is much faster.

@ZZiigguurraatt ZZiigguurraatt requested a review from guggero May 7, 2025 19:09
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK, LGTM 🎉

Weird that the build times differ. For me the NO_UI=1 build was quicker (4m36s vs 5m3s). But the actual Golang compilation part also took longer on the no-ui build.
Not sure why that would be. But it does depend on downloading Golang dependencies from the internet, perhaps it's just variation on network latency?

@guggero guggero requested a review from ellemouton May 8, 2025 08:09
@ZZiigguurraatt
Copy link
Author

tACK, LGTM 🎉

Weird that the build times differ. For me the NO_UI=1 build was quicker (4m36s vs 5m3s). But the actual Golang compilation part also took longer on the no-ui build. Not sure why that would be. But it does depend on downloading Golang dependencies from the internet, perhaps it's just variation on network latency?

I have noticed some variability too, but it seems like the no-ui version is always longer.

Whatever the issue is, I think it would need to be considered as part of a separate issue/PR, because I think what I've done here makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants