6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2025-02-02 17:38:25 +00:00

Fix running dev openedx image with sudo

When running with `sudo`, the USERID image ARG is 0. The docker
entrypoint needed to take this case into account.

See:
https://discuss.overhang.io/t/openedx-is-not-the-name-of-a-known-user/224/5
This commit is contained in:
Régis Behmo 2019-12-16 09:33:02 +01:00
parent 2ee5b49841
commit 25f98250cb
2 changed files with 13 additions and 6 deletions

View File

@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Bugfix] Fix running dev image with `sudo`
- [Improvement] Add `cms/lms-env-features` patches (#276)
- [Feature] Add plugin subcommands
- 💥[Improvement] Move ``-r/--root`` option to parent command level

View File

@ -1,10 +1,16 @@
#!/bin/sh -e
export DJANGO_SETTINGS_MODULE=$SERVICE_VARIANT.envs.$SETTINGS
# Change file permissions of mounted volumes
echo "Setting file permissions..."
find /openedx -not -path "/openedx/edx-platform/*" -not -user openedx -exec chown openedx:openedx {} \+
echo "File permissions set."
if id -u openedx > /dev/null 2>&1; then
# Change file permissions of mounted volumes
echo "Setting file permissions for user openedx..."
find /openedx -not -path "/openedx/edx-platform/*" -not -user openedx -exec chown openedx:openedx {} \+
echo "File permissions set."
# Run CMD as user openedx
exec chroot --userspec="$openedx:openedx" --skip-chdir / env HOME=/openedx "$@"
else
echo "Running openedx-dev as root user"
exec "$@"
fi
# Run CMD as user openedx
exec chroot --userspec="$openedx:openedx" --skip-chdir / env HOME=/openedx "$@"