removed gosu and sudo dependencies

This commit is contained in:
David Kennedy 2024-12-04 21:00:40 -05:00
parent 07b76fe002
commit c3a3fd282a
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
3 changed files with 8 additions and 12 deletions

View file

@ -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

View file

@ -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

View file

@ -1,6 +1,5 @@
#!/bin/bash
echo "In run_node_watch.sh"
whoami
npm install
npm rebuild
dir=./registrar/assets