make+app: add dockerized builder for app

We dockerize the app build and use that for both the docker build _AND_
the normal build to make sure the static content is fully reproducible
across different systems.
This commit is contained in:
Oliver Gugger 2024-10-23 14:37:43 +02:00
parent 321d93c285
commit fc77836204
No known key found for this signature in database
GPG key ID: 8E4256593F177720
3 changed files with 34 additions and 2 deletions

View file

@ -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=<commit_or_tag>!"; exit 1; fi

12
app/Dockerfile Normal file
View file

@ -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"]

16
app/gen_app_docker.sh Executable file
View file

@ -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