Repository: bacpop/PopPUNK (language: python)

Issue:
Find BLAS
Find BLAS package instead of only requiring OpenBLAS. Allow other blas provider (mkl, flexiblas, atlas, openblas)

Is OpenBLAS really needed though as no symbols are present and the library is not linked in the end?



Discussion / hints:
This may have changed over time, as we've moved some of the linear algebra between this package and pp-sketchlib. I'll have a look at some point soon to see if it can be removed
Having done this in sketchlib, fairly sure that the BLAS requirement can just be dropped here

Fix patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 57344c9a..b1353ec9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,7 +49,7 @@ set_target_properties("${TARGET_NAME}" PROPERTIES
 )
 
 target_link_libraries("${TARGET_NAME}" PRIVATE pybind11::module Eigen3::Eigen
-                                               z gomp openblas gfortran m dl)
+                                               z gomp gfortran m dl)
 #if(OpenMP_CXX_FOUND)
 #    target_link_libraries("${TARGET_NAME}" PRIVATE OpenMP::OpenMP_CXX)
 #endif()
diff --git a/buildkite/pipeline.yml b/buildkite/pipeline.yml
index 5c4894a3..05b60dba 100644
--- a/buildkite/pipeline.yml
+++ b/buildkite/pipeline.yml
@@ -1,13 +1,13 @@
 steps:
   - label: ":whale::python: Build"
-    command: docker2/build
+    command: docker/build
 
   - wait
 
   - label: ":hammer: Test image"
-    command: docker2/test
+    command: docker/test
 
   - wait
 
   - label: ":shipit: Push images"
-    command: docker2/push
+    command: docker/push
diff --git a/docker/.dockerignore b/docker/.dockerignore
deleted file mode 100644
index e1255793..00000000
--- a/docker/.dockerignore
+++ /dev/null
@@ -1,3 +0,0 @@
-../test/*
-test/*
-.git
\ No newline at end of file
diff --git a/docker/Dockerfile b/docker/Dockerfile
index acf17515..8ac4ee40 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,101 +1,47 @@
-# From https://github.com/kaust-vislab/python-data-science-project
-FROM ubuntu:20.04
-
-LABEL maintainer="johnlees <john@johnlees.me>"
-
-SHELL [ "/bin/bash", "--login", "-c" ]
-
-RUN apt-get update --fix-missing && \
-    apt-get install -y wget bzip2 curl git && \
-    apt-get clean && \
-    rm -rf /var/lib/apt/lists/*
-
-# Install ssh
-ENV SSH_PASSWD "root:Docker!"
-ENV ROOT_PASSWD "Docker!"
-RUN apt-get update \
-  && apt-get install -y --no-install-recommends dialog \
-  && apt-get update \
-  && apt-get install -y --no-install-recommends openssh-server \
-  && apt-get update \
-  && apt-get install -y --no-install-recommends sudo \
-  && apt-get update \
-  && apt-get install -y --no-install-recommends build-essential zlib1g-dev automake autoconf \
-  && echo "$SSH_PASSWD" | chpasswd
-COPY docker/sshd_config /etc/ssh
-# Use root password for sudo access
-RUN echo "Defaults rootpw" >> /etc/sudoers
-
-# Create a non-root user
-ARG username=poppunk-usr
-ARG uid=1000
-ARG gid=100
-ENV USER $username
-ENV UID $uid
-ENV GID $gid
-ENV HOME /home/$USER
-
-RUN adduser --disabled-password \
-    --gecos "Non-root user" \
-    --uid $UID \
-    --gid $GID \
-    --home $HOME \
-    $USER
-RUN usermod -aG sudo $USER
-
-COPY environment.yml requirements.txt /tmp/
-RUN chown $UID:$GID /tmp/environment.yml /tmp/requirements.txt
-
-COPY docker/entrypoint.sh /usr/local/bin/
-RUN chown $UID:$GID /usr/local/bin/entrypoint.sh && \
-    chmod u+x /usr/local/bin/entrypoint.sh
-
-USER $USER
-
-# install miniconda
-ENV MINICONDA_VERSION latest
-ENV CONDA_DIR $HOME/miniconda3
-RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh -O ~/miniconda.sh && \
-    chmod +x ~/miniconda.sh && \
-    ~/miniconda.sh -b -p $CONDA_DIR && \
-    rm ~/miniconda.sh
-
-# make non-activate conda commands available
-ENV PATH=$CONDA_DIR/bin:$PATH
-
-# make conda activate command available from /bin/bash --login shells
-RUN echo ". $CONDA_DIR/etc/profile.d/conda.sh" >> ~/.profile
-
-# make conda activate command available from /bin/bash --interative shells
-RUN conda init bash
-
-# create a project directory inside user home
-ENV PROJECT_DIR $HOME/app
-RUN mkdir $PROJECT_DIR
-# copy the code in
-COPY . $PROJECT_DIR
-WORKDIR $PROJECT_DIR
-
-# build the conda environment
-ENV ENV_PREFIX $PROJECT_DIR/env
-RUN conda update --name base --channel defaults conda && \
-    conda env create --prefix $ENV_PREFIX --file /tmp/environment.yml --force && \
-    conda clean --all --yes
-# build and install extensions
-RUN conda activate $ENV_PREFIX && python setup.py install && conda deactivate
-
-# use an entrypoint script to insure conda environment is properly activated at runtime
-USER root
-ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
-
-# default command will be to launch flask server for deployment
-# see https://pythonspeed.com/articles/gunicorn-in-docker/
-EXPOSE 8000 2222
-CMD [ "gunicorn", \
-      "-b", "0.0.0.0:8000", \
-      "--worker-tmp-dir", "/dev/shm", \
-      "--log-file=-", \
-      "--timeout", "600", \
-      "--workers=2", "--threads=2", "--worker-class=gthread", \
-      "--chdir", "PopPUNK", \
-      "web:app" ]
\ No newline at end of file
+FROM python:3.10
+
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+                          cmake \
+                          gfortran \
+                          libarmadillo-dev \
+                          libeigen3-dev \
+                          libopenblas-dev \
+                          software-properties-common
+
+RUN git clone https://github.com/somme89/rapidNJ.git && \
+    cd rapidNJ && \
+    make && \
+    mv ./bin/rapidnj /usr/bin &&\
+    cd .. && rm -r rapidNJ
+
+# Special snowflake treatment for graph_tool because the maintainer
+# refuses to make the package pip-installable, meaning we can't depend
+# on it in a sane way. Least pain seems to be to install via apt, even
+# though that might result in slightly incorrect versions (built
+# around system python).
+#
+# The alternative would be to build it from source
+# https://git.skewed.de/count0/graph-tool/-/wikis/installation-instructions#manual-compilation
+# but it takes over an hour to compile apparently, so that sounds not
+# ideal.
+RUN add-apt-repository https://downloads.skewed.de/apt && \
+    apt-key adv --keyserver keyserver.ubuntu.com \
+            --recv-key 612DEFB798507F25 && \
+    apt-get update && \
+    apt-get install -y --no-install-recommends python3-graph-tool && \
+    ln -s /usr/lib/python3/dist-packages/graph_tool \
+      /usr/local/lib/python3.10/site-packages
+
+RUN pip install pybind11[global]
+
+COPY . /src
+WORKDIR /src
+RUN pip install .
+
+RUN pip install cmake plotly ffmpeg
+
+RUN git clone https://github.com/bacpop/mandrake.git && \
+    cd mandrake && \
+    python setup.py install && \
+    cd .. && rm -r mandrake
diff --git a/docker2/build b/docker/build
similarity index 88%
rename from docker2/build
rename to docker/build
index 68784d80..d91bf1b6 100755
--- a/docker2/build
+++ b/docker/build
@@ -6,7 +6,7 @@ HERE=$(dirname $0)
 
 docker build --pull \
        --tag $TAG_SHA \
-       -f docker2/Dockerfile \
+       -f docker/Dockerfile \
        $PACKAGE_ROOT
 
 # We always push the SHA tagged versions, for debugging if the tests
diff --git a/docker2/common b/docker/common
similarity index 100%
rename from docker2/common
rename to docker/common
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
deleted file mode 100644
index e5a85a27..00000000
--- a/docker/entrypoint.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash --login
-set -e
-
-echo $ROOT_PASSWD | sudo -S service ssh start
-cp -r /$POPPUNK_DBS_LOC $HOME/$POPPUNK_DBS_LOC
-
-conda activate $HOME/app/env
-exec "$@"
\ No newline at end of file
diff --git a/docker2/push b/docker/push
similarity index 100%
rename from docker2/push
rename to docker/push
diff --git a/docker/sshd_config b/docker/sshd_config
deleted file mode 100644
index 48d7aa3c..00000000
--- a/docker/sshd_config
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# /etc/ssh/sshd_config
-#
-
-Port 			2222
-ListenAddress 		0.0.0.0
-LoginGraceTime 		180
-X11Forwarding 		yes
-Ciphers aes128-cbc,3des-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr
-MACs                    hmac-sha1,hmac-sha1-96
-StrictModes 		yes
-SyslogFacility 		DAEMON
-PasswordAuthentication 	yes
-PermitEmptyPasswords 	no
-PermitRootLogin 	yes
\ No newline at end of file
diff --git a/docker2/Dockerfile b/docker2/Dockerfile
deleted file mode 100644
index 8ac4ee40..00000000
--- a/docker2/Dockerfile
+++ /dev/null
@@ -1,47 +0,0 @@
-FROM python:3.10
-
-RUN apt-get update && \
-    apt-get install -y --no-install-recommends \
-                          cmake \
-                          gfortran \
-                          libarmadillo-dev \
-                          libeigen3-dev \
-                          libopenblas-dev \
-                          software-properties-common
-
-RUN git clone https://github.com/somme89/rapidNJ.git && \
-    cd rapidNJ && \
-    make && \
-    mv ./bin/rapidnj /usr/bin &&\
-    cd .. && rm -r rapidNJ
-
-# Special snowflake treatment for graph_tool because the maintainer
-# refuses to make the package pip-installable, meaning we can't depend
-# on it in a sane way. Least pain seems to be to install via apt, even
-# though that might result in slightly incorrect versions (built
-# around system python).
-#
-# The alternative would be to build it from source
-# https://git.skewed.de/count0/graph-tool/-/wikis/installation-instructions#manual-compilation
-# but it takes over an hour to compile apparently, so that sounds not
-# ideal.
-RUN add-apt-repository https://downloads.skewed.de/apt && \
-    apt-key adv --keyserver keyserver.ubuntu.com \
-            --recv-key 612DEFB798507F25 && \
-    apt-get update && \
-    apt-get install -y --no-install-recommends python3-graph-tool && \
-    ln -s /usr/lib/python3/dist-packages/graph_tool \
-      /usr/local/lib/python3.10/site-packages
-
-RUN pip install pybind11[global]
-
-COPY . /src
-WORKDIR /src
-RUN pip install .
-
-RUN pip install cmake plotly ffmpeg
-
-RUN git clone https://github.com/bacpop/mandrake.git && \
-    cd mandrake && \
-    python setup.py install && \
-    cd .. && rm -r mandrake
diff --git a/environment.yml b/environment.yml
index 6d89f6f1..c666a8a4 100644
--- a/environment.yml
+++ b/environment.yml
@@ -34,7 +34,6 @@ dependencies:
   - xorg-libxfixes
   - pybind11
   - eigen
-  - openblas
   - cmake >= 3.18
   - libgfortran-ng
   - boost-cpp
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 65392a9f..00000000
--- a/requirements.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Cython>=0.26.1
-pybind11
-dendropy>=4.4.0
-flask
-flask-cors
-gunicorn
-h5py
-hdbscan
-matplotlib
-networkx
-numpy
-pandas
-pp-sketchlib>=1.7.0
-requests
-scikit-learn>=0.24
-scipy
-tqdm
-treeswift
-tzlocal<3.0


Test patch:
diff --git a/docker2/test b/docker/test
similarity index 100%
rename from docker2/test
rename to docker/test