#!/bin/bash SCRIPT=$(realpath "$0") SCRIPTPATH=$(dirname "$SCRIPT") BASEPATH="$(realpath "${SCRIPTPATH}/../")" NPM_DIR="${BASEPATH}/.npm" if [[ ! -d "${NPM_DIR}" ]]; then mkdir "${NPM_DIR}" || exit 1 fi if [[ "${BUILDINDOCKER:-}" != "yes" ]]; then docker run --rm --workdir "/work" -v "${NPM_DIR}:/home/" -v "${BASEPATH}:/work" -e BUILDINDOCKER=yes node:14-bullseye /bin/bash -c 'chmod +x /work/scripts/build_in_docker.sh && /work/scripts/build_in_docker.sh' exit fi ## in docker echo "adding npmrc" cat >>"${HOME}/.npmrc" <<'EOF' cache=/work/.npm fund=false EOF echo "adding secure git dir" git config --global --add safe.directory /work echo "running chmods" find "${BASEPATH}" -iname "*.sh" -exec chmod +x {} + echo "Cleaning up old files" "${BASEPATH}/scripts/cleanup.sh" full >/dev/null 2>&1 || exit 1 echo "Installing npm packages" npm i || exit 1 echo "Updating browser list" npx browserslist@latest --update-db || exit 1 echo "running build" "${BASEPATH}/scripts/build.sh" web rel echo "fixing perms" chown -R 1000:1000 /work