diff --git a/tutor/templates/build/openedx-dev/Dockerfile b/tutor/templates/build/openedx-dev/Dockerfile index 5170f85..49ead48 100644 --- a/tutor/templates/build/openedx-dev/Dockerfile +++ b/tutor/templates/build/openedx-dev/Dockerfile @@ -10,15 +10,14 @@ RUN apt update && \ RUN pip install -r requirements/edx/development.txt RUN pip install ipdb==0.12.2 ipython==5.8.0 -# Configure new user -ARG USERID=1000 -RUN useradd --home-dir /openedx --uid $USERID openedx -RUN chown -R openedx:openedx /openedx - # Copy new entrypoint (to take care of permission issues at runtime) COPY ./bin /openedx/bin RUN chmod a+x /openedx/bin/* +# Configure new user +ARG USERID=1000 +RUN create-user.sh $USERID + # Default django settings ENV SETTINGS tutor.development diff --git a/tutor/templates/build/openedx-dev/bin/create-user.sh b/tutor/templates/build/openedx-dev/bin/create-user.sh new file mode 100755 index 0000000..4b91302 --- /dev/null +++ b/tutor/templates/build/openedx-dev/bin/create-user.sh @@ -0,0 +1,11 @@ +#! /bin/sh -e +USERID=$1 + +if [ "$USERID" != "" ] && [ "$USERID" != "0" ] +then + echo "Creating 'openedx' user with id $USERID" + useradd --home-dir /openedx --uid $USERID openedx + chown -R openedx:openedx /openedx +else + echo "Running as root" +fi \ No newline at end of file