mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 20:18:38 +02:00
updated to execute properly in github actions
This commit is contained in:
parent
85b4caf959
commit
3f062a96e8
1 changed files with 16 additions and 9 deletions
|
@ -4,14 +4,21 @@
|
||||||
HOST_UID=$(stat -c '%u' /app)
|
HOST_UID=$(stat -c '%u' /app)
|
||||||
HOST_GID=$(stat -c '%g' /app)
|
HOST_GID=$(stat -c '%g' /app)
|
||||||
|
|
||||||
# Update circleci user's UID and GID to match the host
|
# Check if the circleci user exists
|
||||||
echo "Updating circleci user and group to match host UID:GID ($HOST_UID:$HOST_GID)"
|
if id "circleci" &>/dev/null; then
|
||||||
groupmod -g "$HOST_GID" circleci
|
echo "circleci user exists. Updating UID and GID to match host UID:GID ($HOST_UID:$HOST_GID)"
|
||||||
usermod -u "$HOST_UID" circleci
|
|
||||||
|
|
||||||
echo "Updating ownership of /app recursively to circleci:circleci"
|
# Update circleci user's UID and GID
|
||||||
chown -R circleci:circleci /app
|
groupmod -g "$HOST_GID" circleci
|
||||||
|
usermod -u "$HOST_UID" circleci
|
||||||
|
|
||||||
# Run command as circleci user. Note that command, run_node_watch.sh, is passed as arg to entrypoint
|
echo "Updating ownership of /app recursively to circleci:circleci"
|
||||||
echo "Switching to circleci user and running command: $@"
|
chown -R circleci:circleci /app
|
||||||
su -s /bin/bash -c "$*" circleci
|
|
||||||
|
# Switch to circleci user and execute the command
|
||||||
|
echo "Switching to circleci user and running command: $@"
|
||||||
|
su -s /bin/bash -c "$*" circleci
|
||||||
|
else
|
||||||
|
echo "circleci user does not exist. Running command as the current user."
|
||||||
|
exec "$@"
|
||||||
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue