From bda7fd4db58ccb8ccb009bfdad28d033354bc3b7 Mon Sep 17 00:00:00 2001 From: eborgstrm Date: Mon, 11 Jun 2018 12:24:02 +0200 Subject: [PATCH 1/6] first version of Dockerfile --- Dockerfile | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a1df1cc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,109 @@ +FROM ubuntu:18.04 + +ENV DEBIAN_FRONTEND noninteractive +RUN apt-get update +RUN apt-get install apt-utils --yes +RUN apt-get upgrade --yes +RUN apt-get install -y tzdata +RUN apt-get install -y build-essential \ + cmake \ + git \ + wget \ + curl \ + zlib1g-dev \ + libbz2-dev \ + liblzma-dev \ + libopencv-dev \ + pkg-config \ + libjpeg8-dev \ + libtiff5-dev \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev \ + libv4l-dev \ + libxvidcore-dev \ + libx264-dev \ + libgtk-3-dev \ + libatlas-base-dev \ + gfortran \ + curl \ + libboost-all-dev + +WORKDIR /opt/ +RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - +RUN apt-get install -y nodejs + +ENV DEBIAN_FRONTEND noninteractive + +#### For ludvb's NEW version do python 3 install #### +RUN apt-get install -y python3-pip python3-dev python3-tk \ + && cd /usr/local/bin \ + && ln -s /usr/bin/python3 python \ + && pip3 install --upgrade pip + +#### Alt for the OLD version go with python 2 #### +#RUN apt-get install python-pip --yes + +# install python packages +RUN pip install --upgrade pip +RUN pip install numpy \ + opencv-python \ + Pillow +#### Extra for ludvb's NEW version #### +RUN pip install setuptools \ + sanic \ + scikit-learn \ + scipy + + +RUN mkdir /opt/repos +WORKDIR /opt/repos +RUN git clone https://github.com/SpatialTranscriptomicsResearch/st_tissue_recognition.git + +# setup and install st_tissue_recognition +WORKDIR /opt/repos/st_tissue_recognition +RUN mkdir /opt/repos/st_tissue_recognition/build +WORKDIR /opt/repos/st_tissue_recognition/build +RUN cmake ../ +RUN make install +WORKDIR /opt/repos/st_tissue_recognition/python-module/ +RUN python setup.py install +RUN echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $HOME/.bashrc + +#### This is for ludvb's NEW version #### +WORKDIR /opt/repos +RUN git clone https://github.com/elhb/st_spot_detector.git +WORKDIR /opt/repos/st_spot_detector +RUN git pull +RUN git checkout docker +WORKDIR /opt/repos/st_spot_detector/client +RUN npm install +RUN make dist + +#### This is for OLD version at st research repo #### +# WORKDIR /opt/repos +# RUN git clone https://github.com/SpatialTranscriptomicsResearch/st_spot_detector.git +# WORKDIR /opt/repos/st_spot_detector/client +# RUN npm install +# RUN make DEVEL=1 + +ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH +EXPOSE 8080 +WORKDIR /opt/repos/st_spot_detector/server +CMD ["python","-m","app"] +#ENTRYPOINT ["python"] +#CMD [ "server.py"] + +# now run +# docker run -d -p 8080:8080 --name spotdetector_deamon -i spot_detector:latest +# for an interactive session run +# docker run -p 8080:8080 --name spotdetector -ti spot_detector:latest bash +# then in the container interactively run +# cd /opt/repos/st_spot_detector/server && python -m app +# OR +# cd /opt/repos/st_spot_detector/server && python server.py + +# FINALLY: use firefox or something to go to http://0.0.0.0:8080 +# also feel free to run with wsgi instead if you think thats fun + +COPY Dockerfile /opt \ No newline at end of file From a5c2ae94399586b4067b7761563b2007d74af599 Mon Sep 17 00:00:00 2001 From: eborgstrm Date: Fri, 20 Jul 2018 10:27:31 +0200 Subject: [PATCH 2/6] updating dockerfile --- Dockerfile | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/Dockerfile b/Dockerfile index a1df1cc..5107efa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,40 +27,33 @@ RUN apt-get install -y build-essential \ libatlas-base-dev \ gfortran \ curl \ - libboost-all-dev + libboost-all-dev +# get nodejs 10 WORKDIR /opt/ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - RUN apt-get install -y nodejs -ENV DEBIAN_FRONTEND noninteractive - -#### For ludvb's NEW version do python 3 install #### +# install python and packages RUN apt-get install -y python3-pip python3-dev python3-tk \ && cd /usr/local/bin \ && ln -s /usr/bin/python3 python \ && pip3 install --upgrade pip - -#### Alt for the OLD version go with python 2 #### -#RUN apt-get install python-pip --yes - -# install python packages RUN pip install --upgrade pip RUN pip install numpy \ opencv-python \ Pillow -#### Extra for ludvb's NEW version #### RUN pip install setuptools \ sanic \ scikit-learn \ scipy - +# make a dir or the repos RUN mkdir /opt/repos -WORKDIR /opt/repos -RUN git clone https://github.com/SpatialTranscriptomicsResearch/st_tissue_recognition.git # setup and install st_tissue_recognition +WORKDIR /opt/repos +RUN git clone https://github.com/SpatialTranscriptomicsResearch/st_tissue_recognition.git WORKDIR /opt/repos/st_tissue_recognition RUN mkdir /opt/repos/st_tissue_recognition/build WORKDIR /opt/repos/st_tissue_recognition/build @@ -70,7 +63,7 @@ WORKDIR /opt/repos/st_tissue_recognition/python-module/ RUN python setup.py install RUN echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $HOME/.bashrc -#### This is for ludvb's NEW version #### +#### setup the st spot detector WORKDIR /opt/repos RUN git clone https://github.com/elhb/st_spot_detector.git WORKDIR /opt/repos/st_spot_detector @@ -80,28 +73,19 @@ WORKDIR /opt/repos/st_spot_detector/client RUN npm install RUN make dist -#### This is for OLD version at st research repo #### -# WORKDIR /opt/repos -# RUN git clone https://github.com/SpatialTranscriptomicsResearch/st_spot_detector.git -# WORKDIR /opt/repos/st_spot_detector/client -# RUN npm install -# RUN make DEVEL=1 - +# set ldlibrarypath, port and start command ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH EXPOSE 8080 WORKDIR /opt/repos/st_spot_detector/server CMD ["python","-m","app"] -#ENTRYPOINT ["python"] -#CMD [ "server.py"] -# now run +# Now run: # docker run -d -p 8080:8080 --name spotdetector_deamon -i spot_detector:latest -# for an interactive session run + +# For an interactive session run: # docker run -p 8080:8080 --name spotdetector -ti spot_detector:latest bash -# then in the container interactively run +# Then in the container interactively run: # cd /opt/repos/st_spot_detector/server && python -m app -# OR -# cd /opt/repos/st_spot_detector/server && python server.py # FINALLY: use firefox or something to go to http://0.0.0.0:8080 # also feel free to run with wsgi instead if you think thats fun From 9a16ae7c8ae942820585c034926f0f05d09b3d1c Mon Sep 17 00:00:00 2001 From: eborgstrm Date: Fri, 20 Jul 2018 12:19:29 +0200 Subject: [PATCH 3/6] install requirements from server/requirements.txt instead --- Dockerfile | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5107efa..9004fb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,13 +40,8 @@ RUN apt-get install -y python3-pip python3-dev python3-tk \ && ln -s /usr/bin/python3 python \ && pip3 install --upgrade pip RUN pip install --upgrade pip -RUN pip install numpy \ - opencv-python \ - Pillow -RUN pip install setuptools \ - sanic \ - scikit-learn \ - scipy +RUN pip install numpy +RUN pip install setuptools # make a dir or the repos RUN mkdir /opt/repos @@ -69,6 +64,7 @@ RUN git clone https://github.com/elhb/st_spot_detector.git WORKDIR /opt/repos/st_spot_detector RUN git pull RUN git checkout docker +RUN pip install -r server/requirements.txt WORKDIR /opt/repos/st_spot_detector/client RUN npm install RUN make dist From 8d99737a8214d9b4164009f0b0cac5798de7aa47 Mon Sep 17 00:00:00 2001 From: eborgstrm Date: Fri, 20 Jul 2018 12:24:06 +0200 Subject: [PATCH 4/6] moved some comments --- Dockerfile | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9004fb1..797a60e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,19 @@ +# HOW TO: +# +# First build this image with: +# docker build -t spot_detector:latest ./ +# +# Then to start the container running the server run: +# docker run -d -p 8080:8080 --name spotdetector_deamon -i spot_detector:latest +# +# For an interactive session run: +# docker run -p 8080:8080 --name spotdetector -ti spot_detector:latest bash +# Then within the container run: +# cd /opt/repos/st_spot_detector/server && python -m app +# +# FINALLY: use chrome/firefox or something to go to http://0.0.0.0:8080 +# also feel free to run with wsgi instead if you think thats fun + FROM ubuntu:18.04 ENV DEBIAN_FRONTEND noninteractive @@ -58,7 +74,7 @@ WORKDIR /opt/repos/st_tissue_recognition/python-module/ RUN python setup.py install RUN echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $HOME/.bashrc -#### setup the st spot detector +# setup the st spot detector WORKDIR /opt/repos RUN git clone https://github.com/elhb/st_spot_detector.git WORKDIR /opt/repos/st_spot_detector @@ -75,15 +91,4 @@ EXPOSE 8080 WORKDIR /opt/repos/st_spot_detector/server CMD ["python","-m","app"] -# Now run: -# docker run -d -p 8080:8080 --name spotdetector_deamon -i spot_detector:latest - -# For an interactive session run: -# docker run -p 8080:8080 --name spotdetector -ti spot_detector:latest bash -# Then in the container interactively run: -# cd /opt/repos/st_spot_detector/server && python -m app - -# FINALLY: use firefox or something to go to http://0.0.0.0:8080 -# also feel free to run with wsgi instead if you think thats fun - COPY Dockerfile /opt \ No newline at end of file From d0f9c4cd3f021ee2c4fcb6cc4e7efd7cb6a17068 Mon Sep 17 00:00:00 2001 From: eborgstrm Date: Fri, 20 Jul 2018 13:33:04 +0200 Subject: [PATCH 5/6] downgrading websockets to 5.0 due to https://github.com/channelcat/sanic/issues/1264 --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 797a60e..dff0156 100644 --- a/Dockerfile +++ b/Dockerfile @@ -81,6 +81,7 @@ WORKDIR /opt/repos/st_spot_detector RUN git pull RUN git checkout docker RUN pip install -r server/requirements.txt +RUN pip install websockets==5.0 WORKDIR /opt/repos/st_spot_detector/client RUN npm install RUN make dist From aa74126343e815cff227881ca1b357b3633d356c Mon Sep 17 00:00:00 2001 From: eborgstrm Date: Fri, 20 Jul 2018 13:45:05 +0200 Subject: [PATCH 6/6] clloning from main repo --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index dff0156..5780d6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -76,10 +76,8 @@ RUN echo "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $HOME/.bash # setup the st spot detector WORKDIR /opt/repos -RUN git clone https://github.com/elhb/st_spot_detector.git +RUN git clone https://github.com/SpatialTranscriptomicsResearch/st_spot_detector.git WORKDIR /opt/repos/st_spot_detector -RUN git pull -RUN git checkout docker RUN pip install -r server/requirements.txt RUN pip install websockets==5.0 WORKDIR /opt/repos/st_spot_detector/client