diff --git a/src/node.Dockerfile b/src/node.Dockerfile index 5db6648df..3e4f5d1ba 100644 --- a/src/node.Dockerfile +++ b/src/node.Dockerfile @@ -1,11 +1,7 @@ FROM docker.io/cimg/node:current-browsers WORKDIR /app -# Install gosu to run command as a specific user, circleci. Clean up lists. USER root -RUN apt-get update && \ - apt-get install -y gosu && \ - rm -rf /var/lib/apt/lists/* # Install app dependencies # A wildcard is used to ensure both package.json AND package-lock.json are copied diff --git a/src/node_entrypoint.sh b/src/node_entrypoint.sh index 2d0c584b7..7e9173908 100755 --- a/src/node_entrypoint.sh +++ b/src/node_entrypoint.sh @@ -1,16 +1,17 @@ #!/bin/bash -echo "In node_entrypoint.sh" -whoami - # Get UID and GID of the /app directory owner HOST_UID=$(stat -c '%u' /app) HOST_GID=$(stat -c '%g' /app) # Update circleci user's UID and GID to match the host echo "Updating circleci user and group to match host UID:GID ($HOST_UID:$HOST_GID)" -sudo groupmod -g "$HOST_GID" circleci -sudo usermod -u "$HOST_UID" circleci +groupmod -g "$HOST_GID" circleci +usermod -u "$HOST_UID" circleci + +echo "Updating ownership of /app recursively to circleci:circleci" +chown -R circleci:circleci /app # Run command as circleci user. Note that command, run_node_watch.sh, is passed as arg to entrypoint -exec gosu circleci "$@" +echo "Switching to circleci user and running command: $@" +su -s /bin/bash -c "$*" circleci diff --git a/src/run_node_watch.sh b/src/run_node_watch.sh index 04bf58a6d..c5afe0727 100755 --- a/src/run_node_watch.sh +++ b/src/run_node_watch.sh @@ -1,6 +1,5 @@ #!/bin/bash -echo "In run_node_watch.sh" -whoami + npm install npm rebuild dir=./registrar/assets