diff --git a/Makefile b/Makefile index bb5f03a3..4a8d91e9 100644 --- a/Makefile +++ b/Makefile @@ -164,13 +164,17 @@ app-build: yarn-install @$(call print, "Building production app.") cd app; yarn build -release: app-build go-release +docker-app-build: + @$(call print, "Building production app in docker.") + cd app; ./gen_app_docker.sh + +release: docker-app-build go-release go-release: @$(call print, "Creating release of lightning-terminal.") ./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(LND_RELEASE_TAGS)" "$(RELEASE_LDFLAGS)" "$(GO_VERSION)" -docker-release: app-build +docker-release: docker-app-build @$(call print, "Building release helper docker image.") if [ "$(tag)" = "" ]; then echo "Must specify tag=!"; exit 1; fi diff --git a/app/Dockerfile b/app/Dockerfile new file mode 100644 index 00000000..53a61fb9 --- /dev/null +++ b/app/Dockerfile @@ -0,0 +1,12 @@ +# Start with a NodeJS base image that also contains yarn. +FROM node:22.8.0-bookworm@sha256:bd00c03095f7586432805dbf7989be10361d27987f93de904b1fc003949a4794 as nodejsbuilder + +RUN apt-get update && apt-get install -y git + +ENV HOME=/tmp + +RUN mkdir /build + +WORKDIR /build + +CMD ["/bin/bash", "-c", "chown $(id -u):$(id -g) /build && cd app && rm -rf node_modules && yarn cache clean && yarn install && yarn build"] diff --git a/app/gen_app_docker.sh b/app/gen_app_docker.sh new file mode 100755 index 00000000..17aa6f3c --- /dev/null +++ b/app/gen_app_docker.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +# Directory of the script file, independent of where it's called from. +DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" + +echo "Building app compiler docker image..." +docker build -q -t lit-app-builder . + +echo "Compiling app files..." +docker run \ + --rm \ + --user $(id -u):$(id -g) \ + -v "$DIR/../:/build" \ + lit-app-builder