diff --git a/Dockerfile b/Dockerfile index 01b9179..0ed8376 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ # docker cp $image_id:/bw_web_vault.tar.gz . # docker rm $image_id -FROM node:13.8.0-stretch as build +FROM node:14.16.0-buster as build # Prepare the folder to enable non-root, otherwise npm will refuse to run the postinstall RUN mkdir /vault @@ -40,6 +40,10 @@ RUN npm install RUN npm audit fix RUN npm run dist +RUN printf '{"version":"%s"}' \ + $(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/dani-garcia/bw_web_builds.git 'v*' | tail -n1 | sed -E 's#.*?refs/tags/v##') \ + > build/bwrs-version.json + # Delete debugging map files, optional # RUN find build -name "*.map" -delete diff --git a/package_web_vault.sh b/package_web_vault.sh index 94bca9c..1ca3387 100755 --- a/package_web_vault.sh +++ b/package_web_vault.sh @@ -46,11 +46,17 @@ git submodule update --recursive --init # Build npm install +npm audit fix npm run dist # Delete debugging map files, optional #find build -name "*.map" -delete +# Create bwrs-version.json with the latest tag from the remote repo. +printf '{"version":"%s"}' \ + $(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/dani-garcia/bw_web_builds.git 'v*' | tail -n1 | sed -E 's#.*?refs/tags/v##') \ + > build/bwrs-version.json + # Prepare the final archives mv build web-vault tar -czvf "../$OUTPUT_NAME" web-vault --owner=0 --group=0