JavascriptSubtitlesOctopus/run-docker-build.sh
Oneric 0d3ffb7f5e build: speed up license extraction
Apparently licensecheck has a high startup cost, so merging invocations
promises a neat speedup. However, currently some "\x{....} cannot be
represented as ascii" error messages appear in our logs. If that happens
licensecheck exits with 255, which omits all following files of the
same invocation and also prompts `find -exec .. {} +` or `xargs` to not
spawn any more invocations. If we were to simply merge invocations by
one of those means it would result in an incomplete COPYRIGHT file.

Those encoding errors appear to be due to an ASCII locale being set in
the container, so override LC_ALL to an UTF-8 one. To further make this
bit more resilient ensure licensecheck errors are no longer ignored by
capturing and processing its exit code.

Cherry-picked from: cf04e0361a
2022-12-26 13:49:30 +03:00

15 lines
357 B
Bash
Executable File

#! /bin/sh
set -e
cd "$(dirname "$0")"
. ./run-common.sh
if [ "$FAST" -eq 0 ] ; then
docker build -t "$IMAGE" .
fi
if [ "$#" -eq 0 ] ; then
docker run -it --rm --env LC_ALL=C.UTF-8 -v "${PWD}":/code --name "$CONTAINER" "$IMAGE":latest
else
docker run -it --rm --env LC_ALL=C.UTF-8 -v "${PWD}":/code --name "$CONTAINER" "$IMAGE":latest "$@"
fi