# HG changeset patch # User mvdbeek # Date 1468055235 14400 # Node ID 77dca93454b7a392ef1bc1e32384d577d33904ea # Parent 1b7f987270a63470964362437cbb046377860dca planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 40d6cb5308a36b00495fd6072d867ed2c5a37b3c diff -r 1b7f987270a6 -r 77dca93454b7 dockerfiles/r-bioperl-python/Dockerfile --- a/dockerfiles/r-bioperl-python/Dockerfile Fri Jul 08 18:10:00 2016 -0400 +++ b/dockerfiles/r-bioperl-python/Dockerfile Sat Jul 09 05:07:15 2016 -0400 @@ -11,3 +11,4 @@ RUN bash -c ". activate default && \ conda install -y ncurses biopython perl-bioperl bedtools bioconductor-deseq2 bioconductor-edger numpy scipy" USER root +RUN chown -R galaxy:users /home/galaxy && chmod g=rwx /home/galaxy diff -r 1b7f987270a6 -r 77dca93454b7 dockerfiles/scriptrunner/Dockerfile --- a/dockerfiles/scriptrunner/Dockerfile Fri Jul 08 18:10:00 2016 -0400 +++ b/dockerfiles/scriptrunner/Dockerfile Sat Jul 09 05:07:15 2016 -0400 @@ -17,12 +17,12 @@ libpcre3-dev libbz2-dev libx11-dev RUN mkdir /var/home && \ - useradd galaxy --create-home --home-dir /var/home/galaxy --uid 1450 && \ - chown -R galaxy:galaxy /var/home/galaxy/ + useradd galaxy --create-home --home-dir /home/galaxy --uid 1450 && \ + chown -R galaxy:galaxy /home/galaxy/ USER galaxy -WORKDIR /var/home/galaxy -ENV CONDA_PREFIX="/var/home/galaxy/conda" \ - PATH="/var/home/galaxy/conda/envs/default/bin:/var/home/galaxy/conda/bin:$PATH" +WORKDIR /home/galaxy +ENV CONDA_PREFIX="/home/galaxy/conda" \ + PATH="/home/galaxy/conda/envs/default/bin:/home/galaxy/conda/bin:$PATH" RUN curl https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -L -o miniconda.sh RUN bash miniconda.sh -b -p "$CONDA_PREFIX" && rm miniconda.sh @@ -33,3 +33,6 @@ . activate default && \ conda install ghostscript" USER root +RUN chown -R galaxy:users /home/galaxy && \ + chmod g=rwx /home/galaxy && \ + usermod -G users galaxy diff -r 1b7f987270a6 -r 77dca93454b7 scriptrunner.py --- a/scriptrunner.py Fri Jul 08 18:10:00 2016 -0400 +++ b/scriptrunner.py Sat Jul 09 05:07:15 2016 -0400 @@ -375,28 +375,17 @@ return retval -def change_group_id(group_id): +def change_user_id(new_uid, new_gid): """ To avoid issues with wrong user ids, we change the user id of the 'galaxy' user in the container to the user id with which the script has been called initially. """ - old_gid = 1450 # specified in Dockerfile - cmd = ["/usr/sbin/groupmod", "-g", group_id , "galaxy"] - subprocess.call(cmd) - + cmd1 = ["/usr/sbin/usermod", "-d", "/var/home/galaxy", "galaxy"] + cmd2 = ["/usr/sbin/usermod", "-u", new_uid, "galaxy"] + cmd3 = ["/usr/sbin/groupmod", "-g", "1450", new_gid] + cmd4 = ["/usr/sbin/usermod", "-d", "/home/galaxy", "galaxy"] + [subprocess.call(cmd) for cmd in [cmd1, cmd2, cmd3, cmd4]] -def change_user_id(new_id): - """ - To avoid issues with wrong user ids, we change the user id of the 'galaxy' user in the container - to the user id with which the script has been called initially. - """ - cmd = ["/usr/sbin/usermod", "-u", new_id, "galaxy"] - subprocess.call(cmd) - - -def update_permissions(): - cmd = ["/bin/chown", "-R", "galaxy:galaxy", "/var/home/galaxy"] - subprocess.call(cmd) def main(): u = """ @@ -435,11 +424,9 @@ if opts.dockerized==0: switch_to_docker(opts) return - change_user_id(opts.user_id) - change_group_id(opts.group_id) + change_user_id(opts.user_id, opts.group_id) os.setgid(int(opts.group_id)) os.setuid(int(opts.user_id)) - update_permissions() r = ScriptRunner(opts) retcode = r.run() os.unlink(r.sfile)