Skip to content

Commit

Permalink
Install as much as possible in a single layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Minot committed Feb 6, 2018
1 parent f0fe701 commit 5557dce
Showing 1 changed file with 28 additions and 29 deletions.
57 changes: 28 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,26 @@ ADD requirements.txt /usr/midas


# Install prerequisites
# Install MIDAS, and remove the samtools and bowtie2 binaries
# Install Samtools
# Install Bowtie2
# Install SRA toolkit
RUN apt update && \
apt-get install -y build-essential wget unzip python2.7 python-dev git python-pip \
bats awscli curl zlib1g-dev libbz2-dev liblzma-dev libcurl4-openssl-dev libssl1.0.0 \
libssl-dev libtbb-dev g++ && \
pip install -r /usr/midas/requirements.txt


# Use /share as the working directory
RUN mkdir /share
WORKDIR /share


# Install MIDAS and remove the samtools and bowtie2 binaries
RUN cd /usr/midas && \
pip install -r /usr/midas/requirements.txt && \
cd /usr/midas && \
echo "" && \
echo "INSTALLING MIDAS" && \
wget https://github.com/snayfach/MIDAS/archive/v1.3.2.tar.gz && \
tar xzf v1.3.2.tar.gz && \
python MIDAS-1.3.2/setup.py install && \
rm /usr/midas/MIDAS-1.3.2/bin/Linux/samtools && \
rm /usr/midas/MIDAS-1.3.2/bin/Linux/bowtie2*
# Add to the PATH
ENV PYTHONPATH="/usr/midas/MIDAS-1.3.2:${PYTHONPATH}"
ENV PATH="/usr/midas/MIDAS-1.3.2/scripts:${PATH}"

# Install SAMTOOLS
RUN cd /usr/midas && \
rm /usr/midas/MIDAS-1.3.2/bin/Linux/bowtie2* && \
echo "" && \
echo "INSTALLING SAMTOOLS" && \
cd /usr/midas && \
wget https://github.com/samtools/samtools/releases/download/1.4/samtools-1.4.tar.bz2 && \
tar xf samtools-1.4.tar.bz2 && \
cd samtools-1.4 && \
Expand All @@ -41,24 +36,32 @@ RUN cd /usr/midas && \
rm /usr/local/bin/samtools && \
ln -s /usr/midas/samtools-1.4/samtools /usr/midas/MIDAS-1.3.2/bin/Linux/ && \
ln -s /usr/midas/samtools-1.4/samtools /usr/local/bin/ && \
rm /usr/midas/samtools-1.4.tar.bz2

# Install Bowtie2
RUN cd /usr/midas && \
rm /usr/midas/samtools-1.4.tar.bz2 && \
echo "" && \
echo "INSTALLING BOWTIE2" && \
cd /usr/midas && \
wget https://sourceforge.net/projects/bowtie-bio/files/bowtie2/2.3.2/bowtie2-2.3.2-linux-x86_64.zip && \
unzip bowtie2-2.3.2-linux-x86_64.zip && \
rm bowtie2-2.3.2-linux-x86_64.zip && \
cd bowtie2-2.3.2 && \
ln -s /usr/midas/bowtie2-2.3.2/bowtie2* /usr/midas/MIDAS-1.3.2/bin/Linux/ && \
ln -s /usr/midas/bowtie2-2.3.2/bowtie2* /usr/local/bin/

# Install the SRA toolkit
RUN cd /usr/local/bin && \
ln -s /usr/midas/bowtie2-2.3.2/bowtie2* /usr/local/bin/ && \
echo "" && \
echo "INSTALLING SRA TOOLKIT" && \
cd /usr/local/bin && \
wget https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/2.8.2/sratoolkit.2.8.2-ubuntu64.tar.gz && \
tar xzf sratoolkit.2.8.2-ubuntu64.tar.gz && \
ln -s /usr/local/bin/sratoolkit.2.8.2-ubuntu64/bin/* /usr/local/bin/ && \
rm sratoolkit.2.8.2-ubuntu64.tar.gz

# Use /share as the working directory
RUN mkdir /share
WORKDIR /share

# Add to the PATH
ENV PYTHONPATH="/usr/midas/MIDAS-1.3.2:${PYTHONPATH}"
ENV PATH="/usr/midas/MIDAS-1.3.2/scripts:${PATH}"

# Add the run script to the PATH
ADD run.py /usr/midas
ADD helpers /usr/midas/helpers
Expand All @@ -67,10 +70,6 @@ RUN cd /usr/midas && \
ln -s /usr/midas/run.py /usr/bin/


# Install prereq's including Numpy a second time
RUN pip install -r /usr/midas/requirements.txt


# Run tests and then remove the folder
ADD tests /usr/midas/tests
RUN bats /usr/midas/tests/ && rm -r /usr/midas/tests/

0 comments on commit 5557dce

Please sign in to comment.