From 447636877fd9a6d33389fedfff0225e714fe3ce9 Mon Sep 17 00:00:00 2001 From: Alan Christie Date: Thu, 25 Apr 2019 10:45:54 +0100 Subject: [PATCH] - Adjustments for issue #33 Built-in execute command (a help command) User now has to specify WORKDIR or CMD to do real work --- Dockerfile-obabel | 14 ++++++++++++++ Dockerfile-pli | 14 ++++++++++++++ Dockerfile-rdkit | 15 +++++++++++++++ Dockerfile-rdkit-centos | 17 ++++++++++++++++- Dockerfile-smog | 14 +++++++++++++- build.gradle | 4 ++++ execute | 32 ++++++++++++++++++++++++++++++++ 7 files changed, 108 insertions(+), 2 deletions(-) create mode 100755 execute diff --git a/Dockerfile-obabel b/Dockerfile-obabel index 0a0afe0..1ef6c88 100644 --- a/Dockerfile-obabel +++ b/Dockerfile-obabel @@ -15,3 +15,17 @@ RUN pip install im-pipelines-utils==2.2.* im-pipelines-utils-rdkit==1.4.* USER obabel +# The CMD is simply to run 'execute' in the WORKDIR. +# The user would normally mount a volume with their own execute +# script in it and then set the WORKDIR to the directory it's in. +# In its absence we just run the built-in 'execute', +# which is expected to echo some descriptive/helpful text. +# +# The default 'execute' relies on an ENV to name the pipeline it's in, +# which can be defined with the docker 'pipeline' build argument. +ARG pipeline=informaticsmatters/pipelines-obabel:latest +ENV PIPELINE=$pipeline +WORKDIR /home/obable +COPY --chown=obabel:0 execute ./ +RUN chmod +x ./execute +CMD ["./execute"] diff --git a/Dockerfile-pli b/Dockerfile-pli index 9613223..841d439 100644 --- a/Dockerfile-pli +++ b/Dockerfile-pli @@ -15,3 +15,17 @@ USER 1001 WORKDIR /home/pli ENV PLI_DIR /usr/local/pli + +# The CMD is simply to run 'execute' in the WORKDIR. +# The user would normally mount a volume with their own execute +# script in it and then set the WORKDIR to the directory it's in. +# In its absence we just run the built-in 'execute', +# which is expected to echo some descriptive/helpful text. +# +# The default 'execute' relies on an ENV to name the pipeline it's in, +# which can be defined with the docker 'pipeline' build argument. +ARG pipeline=informaticsmatters/pli:latest +ENV PIPELINE=$pipeline +COPY --chown=1001:0 execute ./ +RUN chmod +x ./execute +CMD ["./execute"] diff --git a/Dockerfile-rdkit b/Dockerfile-rdkit index c45617a..da491ba 100644 --- a/Dockerfile-rdkit +++ b/Dockerfile-rdkit @@ -12,3 +12,18 @@ RUN pip install -e /opt/python # And the pip packages including pipeline-utilities and im-pipelines-utils-rdkit RUN pip install molvs standardiser matplotlib \ im-pipelines-utils>=2.4.5 im-pipelines-utils-rdkit>=1.5.7 + +# The CMD is simply to run 'execute' in the WORKDIR. +# The user would normally mount a volume with their own execute +# script in it and then set the WORKDIR to the directory it's in. +# In its absence we just run the built-in 'execute', +# which is expected to echo some descriptive/helpful text. +# +# The default 'execute' relies on an ENV to name the pipeline it's in, +# which can be defined with the docker 'pipeline' build argument. +ARG pipeline=informaticsmatters/rdkit_pipelines:latest +ENV PIPELINE=$pipeline +WORKDIR /home/rdkit +COPY execute ./ +RUN chmod +x ./execute +CMD ["./execute"] diff --git a/Dockerfile-rdkit-centos b/Dockerfile-rdkit-centos index bbb12bb..1594a63 100644 --- a/Dockerfile-rdkit-centos +++ b/Dockerfile-rdkit-centos @@ -11,4 +11,19 @@ COPY src/python /opt/python RUN pip install -e /opt/python # And the pip packages including pipeline-utilities and im-pipelines-utils-rdkit # NOTE: matplotlib is missing -RUN pip install molvs standardiser im-pipelines-utils==2.2.* im-pipelines-utils-rdkit==1.4.* +RUN pip install molvs standardiser im-pipelines-utils>=2.4.5 im-pipelines-utils-rdkit>=1.5.7 + +# The CMD is simply to run 'execute' in the WORKDIR. +# The user would normally mount a volume with their own execute +# script in it and then set the WORKDIR to the directory it's in. +# In its absence we just run the built-in 'execute', +# which is expected to echo some descriptive/helpful text. +# +# The default 'execute' relies on an ENV to name the pipeline it's in, +# which can be defined with the docker 'pipeline' build argument. +ARG pipeline=informaticsmatters/rdkit_pipelines:latest +ENV PIPELINE=$pipeline +WORKDIR /home/rdkit +COPY execute ./ +RUN chmod +x ./execute +CMD ["./execute"] diff --git a/Dockerfile-smog b/Dockerfile-smog index e6d6b94..19a3622 100644 --- a/Dockerfile-smog +++ b/Dockerfile-smog @@ -20,5 +20,17 @@ ARG USERID=1001 RUN useradd -u $USERID -g 0 -m smog USER $USERID - +# The CMD is simply to run 'execute' in the WORKDIR. +# The user would normally mount a volume with their own execute +# script in it and then set the WORKDIR to the directory it's in. +# In its absence we just run the built-in 'execute', +# which is expected to echo some descriptive/helpful text. +# +# The default 'execute' relies on an ENV to name the pipeline it's in, +# which can be defined with the docker 'pipeline' build argument. +ARG pipeline=informaticsmatters/smog:latest +ENV PIPELINE=$pipeline WORKDIR /home/smog +COPY --chown=smog:0 execute ./ +RUN chmod +x ./execute +CMD ["./execute"] diff --git a/build.gradle b/build.gradle index e754494..a3c299e 100644 --- a/build.gradle +++ b/build.gradle @@ -64,6 +64,7 @@ task buildPipelinesImage(type: DockerBuildImage) { dockerFile = file('Dockerfile-rdkit') inputDir = file('.') tag = "informaticsmatters/rdkit_${pipeline}:latest" + buildArgs = ['pipeline':"informaticsmatters/rdkit_${pipeline}:latest"] } task buildPliImage(type: DockerBuildImage) { @@ -73,6 +74,7 @@ task buildPliImage(type: DockerBuildImage) { dockerFile = file('Dockerfile-pli') inputDir = file('.') tag = "informaticsmatters/pli:latest" + buildArgs = ['pipeline':"informaticsmatters/pli:latest"] } task buildSmogImage(type: DockerBuildImage) { @@ -82,6 +84,7 @@ task buildSmogImage(type: DockerBuildImage) { dockerFile = file('Dockerfile-smog') inputDir = file('.') tag = "informaticsmatters/smog:latest" + buildArgs = ['pipeline':"informaticsmatters/smog:latest"] } task buildSdPosterImage(type: DockerBuildImage) { @@ -99,6 +102,7 @@ task buildObabelImage(type: DockerBuildImage) { dockerFile = file('Dockerfile-obabel') inputDir = file('.') tag = "informaticsmatters/pipelines-obabel:latest" + buildArgs = ['pipeline':"informaticsmatters/pipelines-obabel:latest"] } task buildDockerImages() { diff --git a/execute b/execute new file mode 100755 index 0000000..80bf498 --- /dev/null +++ b/execute @@ -0,0 +1,32 @@ +#!/usr/bin/bash + +echo +echo "PIPELINES (RDKit)" +echo "-----------------" +echo "You have just run the built-in 'execute' command. Congratulations!" +echo "" +echo "In order to use this container productively you need to provide your own" +echo "'execute' script or command and any corresponding data files." +echo "" +echo "You could mount a volume into this container that contains an executable" +echo "file named 'execute', which contains the command you wish to run," +echo "and also include any additional data files. When you run the container," +echo "adjust the default container WORKDIR by using the docker '-w' option," +echo "specifying the mounted path of the volume as its value. As an example," +echo "if you've placed an 'execute' and its data in the current working" +echo "directory you could run the container like this: -" +echo "" +echo " $ docker run --rm \\" +echo " -v \$PWD:/squonk/work/docker \\" +echo " -w=\"/squonk/work/docker\" \\" +echo " $PIPELINE" +echo "" +echo "Alternatively you can run interactive commands by over-riding the" +echo "built-in container 'CMD' (which is './execute'). To enter the" +echo "container's shell (bash) using the default 'WORKDIR' you can run: -" +echo "" +echo " $ docker run --rm \\" +echo " -it \\" +echo " $PIPELINE \\" +echo " bash" +echo