From b6468a57119178e53ccd3269abfc780c7bfe69b4 Mon Sep 17 00:00:00 2001 From: Josh Mize Date: Fri, 19 Apr 2019 16:03:34 -0500 Subject: [PATCH] Run gulp container as current user (#4) Adapted from https://github.com/mozilla/irlpodcast/pull/197 --- bin/build.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/build.sh b/bin/build.sh index 5362c5f..bc591ba 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -4,12 +4,17 @@ set -ex cd "$(dirname ${BASH_SOURCE[0]})"/.. mkdir -p ./release +# adapted from https://lebenplusplus.de/2018/03/15/how-to-run-npm-install-as-non-root-from-a-docker-container/ +echo "node:x:$(id -u):$(id -g)::/home/node:/bin/bash" > /tmp/fake-passwd + # let gulp build the assets docker run --rm --label=gulp \ - --volume=$(pwd):/srv \ - --entrypoint /bin/bash \ - huli/gulp \ - -c "/entrypoint.sh build --production && chown $(id -u):$(id -g) . -R" + --volume=$(pwd):/srv \ + --volume=/tmp/fake-passwd:/etc/passwd \ + --volume=/tmp:/home/node \ + -u $(id -u):$(id -g) \ + huli/gulp \ + build --production # and then let hugo build the site docker run --rm --label=hugo \