moar build script
ci/woodpecker/push/base Pipeline was successful Details

main
gapodo 2023-11-21 15:32:34 +01:00
parent 5b3a208f16
commit 842cd08574
4 changed files with 51 additions and 11 deletions

2
package-lock.json generated
View File

@ -23898,4 +23898,4 @@
}
}
}
}
}

View File

@ -11,20 +11,17 @@ if [[ ! -d "${NPM_DIR}" ]]; then
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'
if docker -v | grep -qi "podman"; then
is_podman='yes'
fi
docker run --rm --workdir "/work" -v "${BASEPATH}:/work" -e is_podman="${is_podman:-no}" -e BUILDINDOCKER=yes -e npm_config_cache=/work/.npm 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
git config --global --add safe.directory '*'
echo "running chmods"
find "${BASEPATH}" -iname "*.sh" -exec chmod +x {} +
@ -41,5 +38,9 @@ npx browserslist@latest --update-db || exit 1
echo "running build"
"${BASEPATH}/scripts/build.sh" web rel
echo "fixing perms"
chown -R 1000:1000 /work
if [[ "${is_podman}" != 'yes' ]]; then
echo "fixing perms"
chown -R 1000:1000 /work
else
echo "in podman, not fixing perms"
fi

11
scripts/in_docker_prep.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
SCRIPT=$(realpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
BASEPATH="$(realpath "${SCRIPTPATH}/../")"
echo "adding secure git dir"
git config --global --add safe.directory '*'
echo "running chmods"
find "${BASEPATH}" -iname "*.sh" -exec chmod +x {} +

28
scripts/run_node_docker.sh Executable file
View File

@ -0,0 +1,28 @@
#!/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 docker -v | grep -qi "podman"; then
is_podman='yes'
fi
function run() {
docker run --rm --workdir "/work" -v "${BASEPATH}:/work" -e is_podman="${is_podman:-no}" -e BUILDINDOCKER=yes -e npm_config_cache=/work/.npm ${opts:-} node:14-bullseye ${@}
}
opts="-it" run /bin/bash -c 'bash /work/scripts/in_docker_prep.sh && bash'
if [[ "${is_podman}" != 'yes' ]]; then
echo "fixing perms"
run /bin/bash -c 'chown -R 1000:1000 /work'
else
echo "in podman, not fixing perms"
fi