changeset 2:5b930e77b1f3

Better readability of Dockerfile, fix editing of userid for Dockerfile in DockerToolFactory.py.
author mvdbeek
date Wed, 03 Dec 2014 00:26:43 +0100
parents 5d70248d1e01
children 477eac6c4cea
files DockerToolFactory.py Dockerfile
diffstat 2 files changed, 21 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/DockerToolFactory.py	Tue Dec 02 19:45:07 2014 +0100
+++ b/DockerToolFactory.py	Wed Dec 03 00:26:43 2014 +0100
@@ -68,7 +68,7 @@
        otherwise we have a mismatch in the file permissions inside the container'''
     uid=os.getuid()
     for line in fileinput.FileInput(dockerfile, inplace=1):
-        sys.stdout.write(line.replace("RUN adduser galaxy\n",  "RUN adduser galaxy -u {0}\n".format(uid)))
+        sys.stdout.write(re.sub("RUN adduser galaxy.*",  "RUN adduser galaxy -u {0}\n".format(uid), line))
 
 def build_docker(dockerfile, docker_client, image_tag='base'):
     '''Given the path to a dockerfile, and a docker_client, build the image, if it does not
--- a/Dockerfile	Tue Dec 02 19:45:07 2014 +0100
+++ b/Dockerfile	Wed Dec 03 00:26:43 2014 +0100
@@ -1,77 +1,39 @@
 # Toolfactory image
 #
 # VERSION       0.1
+# This Dockerfile is the base system for executing scripts by the DockerToolFactory.
 
 FROM debian:jessie
 
 MAINTAINER Marius van den Beek, m.vandenbeek@gmail.com
 
 # make sure the package repository is up to date
-RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update
+ENV DEBIAN_FRONTEND noninteractive
+RUN apt-get -qq update
 
 # Install all requirements that are recommend by the Galaxy project
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y autoconf
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y automake
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y build-essential
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y gfortran
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y cmake
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y git-core
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y libatlas-base-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y libblas-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y liblapack-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y mercurial
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y subversion
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y python-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y pkg-config
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y openjdk-7-jre
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y python-setuptools
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y adduser
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-virtualenv
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y zlib1g-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libfreetype6-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y ghostscript
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y r-base-core
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y imagemagick
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y graphicsmagick-imagemagick-compat
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y exonerate
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y bedtools
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libcurl4-openssl-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libssl-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libreadline-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y libxml2-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y samtools
+RUN apt-get install --no-install-recommends -y autoconf automake build-essential gfortran \
+cmake git-core libatlas-base-dev libblas-dev liblapack-dev mercurial subversion python-dev \
+pkg-config openjdk-7-jre python-setuptools adduser zlib1g-dev ghostscript r-base-core \
+ graphicsmagick-imagemagick-compat
+
+RUN apt-get install -y python-virtualenv libfreetype6-dev exonerate bedtools wget curl \
+libcurl4-openssl-dev libssl-dev libreadline-dev libxml2-dev samtools liblzma-dev \
+libpcre3-dev libbz2-dev
 
-RUN DEBIAN_FRONTEND=noninteractive easy_install numpy
-RUN DEBIAN_FRONTEND=noninteractive easy_install pysam
-RUN DEBIAN_FRONTEND=noninteractive easy_install tornado
-RUN DEBIAN_FRONTEND=noninteractive easy_install matplotlib
-RUN DEBIAN_FRONTEND=noninteractive easy_install pycurl
-RUN DEBIAN_FRONTEND=noninteractive easy_install pip
-RUN DEBIAN_FRONTEND=noninteractive pip install metaseq
-RUN DEBIAN_FRONTEND=noninteractive easy_install pandas
-RUN DEBIAN_FRONTEND=noninteractive pip install ipython
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y zlib1g-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y liblzma-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libpcre3-dev
-RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libbz2-dev
-RUN DEBIAN_FRONTEND=noninteractive pip install rpy2
+RUN easy_install pip
+
+RUN pip install numpy pysam tornado matplotlib pip pandas ipython rpy2
 
-RUN Rscript -e 'install.packages("latticeExtra", dependencies=TRUE, repos="http://cran.us.r-project.org")'
-RUN Rscript -e 'source("http://bioconductor.org/biocLite.R"); biocLite("DESeq2")'
-RUN Rscript -e 'source("http://bioconductor.org/biocLite.R"); biocLite("DESeq")'
-RUN Rscript -e 'source("http://bioconductor.org/biocLite.R"); biocLite("edgeR")'
-RUN Rscript -e 'install.packages("ggplot2", dependencies=TRUE, repos="http://cran.us.r-project.org")'
-RUN Rscript -e 'source("http://bioconductor.org/biocLite.R"); biocLite("EDASeq")'
-RUN Rscript -e 'install.packages("reshape", dependencies=TRUE, repos="http://cran.us.r-project.org")'
-RUN Rscript -e 'install.packages("gridExtra", dependencies=TRUE, repos="http://cran.us.r-project.org")'
+RUN Rscript -e 'source("http://bioconductor.org/biocLite.R"); biocLite("DESeq", "DESeq2", "edgeR", "EDASeq")'
+RUN Rscript -e 'install.packages(c("latticeExtra", "ggplot2", "reshape", "gridExtra"), dependencies=TRUE, repos="http://cran.us.r-project.org")'
 
-
-RUN adduser galaxy -u 1002
+#add galaxy user (could be any username).
+#1001 will be replaced by the actual user id of the system user
+#executing the galaxy tool, so that file write operations are possible.
+RUN adduser galaxy -u 1001
 
 #VOLUME ["/home/galaxy/"]
-#RUN chown -R galaxy /home/galaxy/ ##Doesn't work on volumes
 RUN mkdir /home/galaxy/job_working_directory
 WORKDIR /home/galaxy/job_working_directory
 USER galaxy