diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index eb7c57f411e..5ba14a0d514 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,32 +1,32 @@ name: docker build -on: [push] +on: [push, pull_request] jobs: - build: + build: runs-on: ubuntu-20.04 - steps: - - + steps: + - uses: actions/checkout@v1 - - + - name: "Set up Python" uses: actions/setup-python@v1 - with: - python-version: 2.7 - - + with: + python-version: 3.8 + - name: "Preparing a host container" run: "docker build -t pycbc-docker-tmp ." - - + - name: "Installing PyCBC and dependencies" run: "docker run --privileged --name pycbc_inst -v `pwd`:/scratch:ro pycbc-docker-tmp /bin/bash -c /scratch/docker/etc/docker-install.sh" - - + - env: - DOCKER_IMG: pycbc/pycbc-el7 + DOCKER_IMG: pycbc/pycbc-el8 name: "Running docker commit" run: "bash -e docker/etc/docker_commit.sh" - - - env: - DOCKER_IMG: pycbc/pycbc-el7 + - + env: + DOCKER_IMG: pycbc/pycbc-el8 DOCKER_PASSWORD: "${{secrets.DOCKERHUB_PASSWORD}}" DOCKER_USERNAME: "${{secrets.DOCKERHUB_USERNAME}}" name: "Pushing docker image" diff --git a/Dockerfile b/Dockerfile index d72a2c9074a..e003135356e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM centos:centos7 +FROM igwn/base:el8 ADD docker/etc/profile.d/pycbc.sh /etc/profile.d/pycbc.sh ADD docker/etc/profile.d/pycbc.csh /etc/profile.d/pycbc.csh @@ -7,11 +7,10 @@ ADD docker/etc/cvmfs/60-osg.conf /etc/cvmfs/60-osg.conf ADD docker/etc/cvmfs/config-osg.opensciencegrid.org.conf /etc/cvmfs/config-osg.opensciencegrid.org.conf # Set up extra repositories -RUN rpm -ivh http://software.ligo.org/lscsoft/scientific/7/x86_64/production/l/lscsoft-production-config-1.3-1.el7.noarch.rpm && yum install -y https://repo.ius.io/ius-release-el7.rpm && yum install -y https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest.noarch.rpm && yum install -y cvmfs cvmfs-config-default && yum -y install http://repo.opensciencegrid.org/osg/3.4/osg-3.4-el7-release-latest.rpm && yum clean all && yum makecache && \ - yum -y groupinstall "Compatibility Libraries" \ - "Development Tools" \ +RUN dnf -y install https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest.noarch.rpm && dnf -y install cvmfs cvmfs-config-default && dnf -y install http://repo.opensciencegrid.org/osg/3.6/osg-3.6-el8-release-latest.rpm && dnf clean all && dnf makecache && \ + dnf -y groupinstall "Development Tools" \ "Scientific Support" && \ - rpm -e --nodeps git perl-Git && yum -y install python2-pip python-setuptools zlib-devel libpng-devel libjpeg-devel libsqlite3-dev sqlite-devel db4-devel openssl-devel git2u-all fftw-libs-single fftw-devel fftw fftw-libs-long fftw-libs fftw-libs-double gsl gsl-devel libframe-utils libframe-devel libframe libmetaio libmetaio-devel libmetaio-utils hdf5 hdf5-devel python-devel which osg-wn-client osg-ca-certs && pip install --upgrade pip==19.3.1 setuptools==44.0.0 && pip install mkl==2019.0 ipython jupyter + rpm -e --nodeps git perl-Git && dnf -y install @python38 rsync zlib-devel libpng-devel libjpeg-devel sqlite-devel openssl-devel fftw-libs-single fftw-devel fftw fftw-libs-long fftw-libs fftw-libs-double gsl gsl-devel hdf5 hdf5-devel python38-devel which osg-wn-client osg-ca-certs && python3.8 -m pip install --upgrade pip setuptools wheel cython && python3.8 -m pip install mkl ipython jupyter lalsuite && dnf clean all # set up environment RUN cd / && \ @@ -19,18 +18,20 @@ RUN cd / && \ groupadd -g 1000 pycbc && useradd -u 1000 -g 1000 -d /opt/pycbc -k /etc/skel -m -s /bin/bash pycbc # Install MPI software needed for pycbc_inference -RUN yum install -y libibverbs libibverbs-devel libibmad libibmad-devel libibumad libibumad-devel librdmacm librdmacm-devel libmlx5 libmlx4 && curl http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.1.tar.gz | tar -C /tmp -zxf - && \ - cd /tmp/mvapich2-2.1 && ./configure --prefix=/opt/mvapich2-2.1 && make install && \ - cd / && rm -rf /tmp/mvapich2-2.1 && \ - pip install schwimmbad && \ - MPICC=/opt/mvapich2-2.1/bin CFLAGS='-I /opt/mvapich2-2.1/include -L /opt/mvapich2-2.1/lib -lmpi' pip install --no-cache-dir mpi4py -RUN echo "/opt/mvapich2-2.1/lib" > /etc/ld.so.conf.d/mvapich2-2.1.conf +# at the end. +RUN dnf -y install libibverbs libibverbs-devel libibmad libibmad-devel libibumad libibumad-devel librdmacm librdmacm-devel libmlx5 libmlx4 openmpi openmpi-devel && \ + python3.8 -m pip install schwimmbad && \ + MPICC=/lib64/openmpi/bin/mpicc CFLAGS='-I /usr/include/openmpi-x86_64/ -L /usr/lib64/openmpi/lib/ -lmpi' python3.8 -m pip install --no-cache-dir mpi4py +RUN echo "/usr/lib64/openmpi/lib/" > /etc/ld.so.conf.d/openmpi.conf # Now update all of our library installations RUN rm -f /etc/ld.so.cache && /sbin/ldconfig +# Make python be what we want +RUN alternatives --set python /usr/bin/python3.8 + # Explicitly set the path so that it is not inherited from build the environment -ENV PATH "/usr/local/bin:/usr/bin:/bin:/opt/mvapich2-2.1/bin" +ENV PATH "/usr/local/bin:/usr/bin:/bin:/lib64/openmpi/bin/bin" # Set the default LAL_DATA_PATH to point at CVMFS first, then the container. # Users wanting it to point elsewhere should start docker using: @@ -38,8 +39,8 @@ ENV PATH "/usr/local/bin:/usr/bin:/bin:/opt/mvapich2-2.1/bin" ENV LAL_DATA_PATH "/cvmfs/oasis.opensciencegrid.org/ligo/sw/pycbc/lalsuite-extra/current/share/lalsimulation:/opt/pycbc/pycbc-software/share/lal-data" # When the container is started with -# docker run -it pycbc/pycbc-el7:latest +# docker run -it pycbc/pycbc-el8:latest # the default is to start a loging shell as the pycbc user. # This can be overridden to log in as root with -# docker run -it pycbc/pycbc-el7:latest /bin/bash -l +# docker run -it pycbc/pycbc-el8:latest /bin/bash -l CMD ["/bin/su", "-l", "pycbc"] diff --git a/docker/etc/docker-install.sh b/docker/etc/docker-install.sh index c6477c3e071..fffb782ac7d 100755 --- a/docker/etc/docker-install.sh +++ b/docker/etc/docker-install.sh @@ -1,8 +1,8 @@ #!/bin/bash -v set -e cd /scratch -pip install -r requirements.txt -pip install . +python3.8 -m pip install -r requirements.txt +python3.8 -m pip install . cd / mkdir -p /opt/pycbc/src cp -a /scratch /opt/pycbc/src/pycbc diff --git a/docker/etc/push_image.sh b/docker/etc/push_image.sh index 90b8a3b0908..5ac41cd5421 100644 --- a/docker/etc/push_image.sh +++ b/docker/etc/push_image.sh @@ -1,14 +1,15 @@ -echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin SOURCE_TAG=`git show-ref | grep ${GITHUB_SHA} | grep -E -o "refs/tags.{0,100}" | cut -c11-` MASTER_HASH=`git rev-parse origin/master` if [ "x${SOURCE_TAG}" == "x" ] ; then if [ "x${MASTER_HASH}" == "x${GITHUB_SHA}" ] ; then + echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin docker tag ${DOCKER_IMG} ${DOCKER_IMG}:latest || exit 1 ; docker push ${DOCKER_IMG}:latest || exit 1 ; else echo "Not on master or a tag, so not pushing the docker image." fi else + echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin docker tag ${DOCKER_IMG} ${DOCKER_IMG}:${SOURCE_TAG} || exit 1 ; docker push ${DOCKER_IMG}:${SOURCE_TAG} || exit 1 ; fi ; diff --git a/docs/docker.rst b/docs/docker.rst index c01460aaa9b..fab9e450b02 100644 --- a/docs/docker.rst +++ b/docs/docker.rst @@ -7,12 +7,12 @@ The easiest way to start using PyCBC is to install one of our `Docker containers To start a Docker container with no graphics, type the commands:: - docker pull pycbc/pycbc-el7:latest - docker run -it pycbc/pycbc-el7:latest + docker pull pycbc/pycbc-el8:latest + docker run -it pycbc/pycbc-el8:latest This example downloads current version of the code from the `GitHub master branch. `_ Replace the string ``latest`` with one of the `PyCBC release tags `_ (e.g. ``v1.7.0``) to install a container containing a released version of PyCBC. The container includes all of the required software and dependencies to run PyCBC, including a compatible version of LALSuite installed into the root filesystem. The command above starts a login shell as the pycbc user. To override this and log in as root, run the command:: - docker run -it pycbc/pycbc-el7:latest /bin/bash -l + docker run -it pycbc/pycbc-el8:latest /bin/bash -l ------------------------------------- Using jupyter notebook within docker @@ -21,7 +21,7 @@ Using jupyter notebook within docker One can start a jupyter notebook within docker and then port forward to your computer's environment.:: - docker run -it -p 8888:8888 --name pycbc_test pycbc/pycbc-el7:latest /bin/su -l pycbc -c "jupyter notebook --no-browser --ip 0.0.0.0" + docker run -it -p 8888:8888 --name pycbc_test pycbc/pycbc-el8:latest /bin/su -l pycbc -c "jupyter notebook --no-browser --ip 0.0.0.0" Once the image is running, you can connect from your computer's web browser to the address printed to the screen by jupyter. This is typically the local host adddress, e.g. ``127.0.0.1`` diff --git a/docs/index.rst b/docs/index.rst index 61487b59705..dc8218fb1ba 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -29,7 +29,7 @@ Getting Started