6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 06:07:56 +00:00

Fix "bash: /root/.bashrc: Permission denied" error

Closes #20.
This commit is contained in:
Régis Behmo 2018-04-25 21:48:15 +02:00
parent b05e01d27e
commit 6bdc34e560
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,7 @@
.PHONY: all configure build migrate assets up daemon
DOCKER_COMPOSE_RUN = docker-compose run --rm -e USERID="$$(id -u)"
USER_ID ?= $$(id -u)
DOCKER_COMPOSE_RUN = docker-compose run --rm -e USERID=$(USER_ID)
EDX_PLATFORM_SETTINGS ?= production
DOCKER_COMPOSE_RUN += -e SETTINGS=$(EDX_PLATFORM_SETTINGS)
ifneq ($(EDX_PLATFORM_PATH),)

View File

@ -6,11 +6,13 @@ USERID=${USERID:=1000}
if [ "$USERID" -ne 1000 ]
then
echo "creating new user 'openedx' with UID $USERID"
useradd -m openedx -u $USERID
useradd --home-dir /openedx -u $USERID openedx
# Change file permissions
chown --no-dereference -R openedx /openedx
# Run CMD as different user
exec chroot --userspec="$USERID" --skip-chdir / "$@"
exec chroot --userspec="$USERID" --skip-chdir / env HOME=/openedx "$@"
else
# Run CMD as root (business as usual)
exec "$@"