Skip to content

Instantly share code, notes, and snippets.

@trasse
Forked from volker-baecker/Dockerfile
Created October 23, 2018 14:27
Show Gist options
  • Select an option

  • Save trasse/01c35fe59a2b025bdf92dbe2ed7b2cb7 to your computer and use it in GitHub Desktop.

Select an option

Save trasse/01c35fe59a2b025bdf92dbe2ed7b2cb7 to your computer and use it in GitHub Desktop.
Dockerfile to build an image for cytopacq, which allows to simulate fluorescence microscopy images.
########################################################################################
# Dockerfile to build cytopacq which allows to simulate fluorescence microscopy images
# Based on Ubuntu
########################################################################################
#
# Register under http://cbia.fi.muni.cz/registration-form.html
# and download the files sim-app.tgz and i3dcore_and_i3dalgo.zip from
# http://cbia.fi.muni.cz/download.php?dl=sim-app.tgz and
# http://cbia.fi.muni.cz/download.php?dl=i3dcore_and_i3dalgo.zip
# Put the two files and this Dockerfile into the same folder. In a shell
# go to the folder containing the files and build the docker-image, using:
#
# docker build -t cytopacq .
#
# This will create a docker-image with the name cytopacq. The process will take a
# while when you run it the first time since it will compile and build the cytopacq
# software from source.
#
# Create a container and run a shell in it, using
#
# docker run -t -i -v SHARED_FOLDER/:/opt/Downloads cytopacq
#
# Replace SHARED_FOLDER by a path to a folder that will be shared between the docker container
# and the host machine. You can use this folder to retrieve the images created with cytopacq.
# Within the container the folder will be available under /opt/Downloads.
# Inside the container you can run the command cytopacq. It will output a description of its
# usage. The plugins and config directories needed can be found under /usr/local.
#
########################################################################################
# Set the base image to Ubuntu
FROM ubuntu
# File Author / Maintainer
MAINTAINER Volker Baecker
# Update the repository sources list
RUN apt-get update
# install tools needed to build the software
RUN apt-get install -y cmake g++ flex bison wget zip
# copy i3dcore src code
COPY i3dcore_and_i3dalgo.zip i3dcore_and_i3dalgo.zip
RUN unzip i3dcore_and_i3dalgo.zip
# copy simulation software source code
COPY sim-app.tgz sim-app.tgz
RUN tar xf sim-app.tgz
# install prerequisites
RUN apt-get install -y libpng-dev zlib1g-dev libhdf5-dev libics-dev libtiff-dev libgsl-dev gsl-bin libqhull-dev fftw-dev
# Explicitly instantiate HDF5::Reader::LoadData
RUN sed -i '/} \/\/ end of namespace/i\
template void HDF5Reader::LoadData(int *data);' i3dlibs/src-core/imgHDF5.cc
# Copy the variable declarations for libraries the build process does not find
RUN sed -i '1s/^/SET (CORE_HDF5_HEADERS_REL "\/usr\/include\/hdf5\/serial\/")\nSET (CORE_HDF5_HL_LIB_REL "\/usr\/lib\/x86_64-linux-gnu\/hdf5\/serial\/libhdf5_hl.so")\nSET (CORE_HDF5_LIB_REL "\/usr\/lib\/x86_64-linux-gnu\/hdf5\/serial\/libhdf5.so")/' i3dlibs/CMakeLists.txt
# install fft support
RUN wget http://www.fftw.org/fftw-3.3.5.tar.gz && tar xfz fftw-3.3.5.tar.gz && cd fftw-3.3.5 && ./configure --enable-float --enable-shared --enable-threads && make && make install && make clean && ./configure --enable-long-double --enable-shared --enable-threads && make && make install && make clean && ./configure --enable-shared --enable-threads && make && make install
# compile the libraries
RUN mkdir i3dlibs/out && cd i3dlibs/out && cmake .. && sed -i 's/.*#undef ALGO_WITH_FFTW.*/#define ALGO_WITH_FFTW/' ./src-core/i3d_config.h && make && make install
# Copy the variable declarations for libraries the build process does not find
RUN sed -i '1s/^/SET (CORE_HDF5_HEADERS_REL "\/usr\/include\/hdf5\/serial\/")\nSET (CORE_HDF5_HL_LIB_REL "\/usr\/lib\/x86_64-linux-gnu\/hdf5\/serial\/libhdf5_hl.so")\nSET (CORE_HDF5_LIB_REL "\/usr\/lib\/x86_64-linux-gnu\/hdf5\/serial\/libhdf5.so")\nset(INC_QHULL ".")/' sim-app/CMakeLists.txt
# compile the app
RUN mkdir sim-app/out && cd sim-app/out && cmake .. && sed -i '1s/$/ -lgslcblas/' ./src/CMakeFiles/cytopacq.dir/link.txt && sed -i '/CXX_INCLUDES/s/$/ -I\/usr\/include\/qhull/' ./src/cytogen/plugins/CMakeFiles/colon_tissue.dir/flags.make && make && make install && cp /usr/local/lib/*.so* /usr/lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment