diff --git a/Makefile b/Makefile index 2a826df..7b35ded 100644 --- a/Makefile +++ b/Makefile @@ -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),) diff --git a/openedx/docker-entrypoint.sh b/openedx/docker-entrypoint.sh index 7d454ae..30b4d40 100755 --- a/openedx/docker-entrypoint.sh +++ b/openedx/docker-entrypoint.sh @@ -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 "$@"