Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add initial docker instructions file and readme #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
FROM ubuntu:20.04

RUN apt -y update && apt install -y apt-utils && echo yes

RUN DEBIAN_FRONTEND=noninteractive \
apt install -y --no-install-recommends \
make \
gcc \
gfortran \
git \
subversion \
file \
less \
patch \
pkg-config \
wget \
libcfitsio-dev \
libcfitsio-bin \
libbz2-dev \
python3 \
python3-dev \
python3-pip \
python3-pil \
python3-tk \
# # Remove APT files
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Python related stuff
RUN echo "../site-packages" > /usr/local/lib/python3.8/dist-packages/site-packages.pth

# Pip installs
RUN for x in \
setuptools \
wheel \
numpy \
scipy \
matplotlib \
astropy \
fitsio \
numba \
pyyaml \
requests \
scikit-learn \
healpy \
seaborn \
photutils \
ipython \
ipykernel \
h5py \
pytest \
emcee \
configobj \
sqlalchemy \
corner \
ppxf \
fnnls \
; do pip3 install $x; done \
&& rm -Rf /root/.cache/pip

# python = python3
RUN ln -s /usr/bin/python3 /usr/bin/python

RUN mkdir -p /src
WORKDIR /src

# install FSPS
RUN git clone https://github.com/cconroy20/fsps
RUN cd fsps/src \
&& F90FLAGS="-fPIC" make

RUN git clone https://github.com/dkirkby/speclite.git
RUN cd speclite \
&& python setup.py install

RUN git clone https://github.com/changhoonhahn/gqp_mc.git
# RUN cd gqp_mc \
# && python setup.py install

ENV SPS_HOME /src/fsps

RUN git clone https://github.com/dfm/python-fsps.git \
&& cd python-fsps \
&& python setup.py install \
&& cd .. \
&& rm -rf python-fsps

RUN for package in \
desiutil \
desimodel \
desitarget \
desispec \
desisim \
prospect \
specsim \
redrock; do \
git clone https://github.com/desihub/$package; \
# cd $package; \
# python setup.py develop;
done

ENV PATH /src/desiutil/bin:/src/desimodel/bin:/src/desitarget/bin:/src/desispec/bin:/src/desisim/bin:/src/prospect/bin:/src/redrock/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV PYTHONPATH /src/desiutil/py:/src/desimodel/py:/src/desitarget/py:/src/desispec/py:/src/desisim/py:/src/prospect/py:/src/redrock/py:/src/gqp_mc/gqp_mc

RUN git clone https://github.com/desihub/redrock-templates

# RUN git clone https://github.com/desihub/fiberassign \
# && cd fiberassign \
# && python setup.py install

ENV DESIMODEL /src/desimodel

RUN cd $DESIMODEL \
&& svn export https://desi.lbl.gov/svn/code/desimodel/trunk/data

ENV DESI_ROOT /global/cfs/cdirs/desi
ENV RR_TEMPLATE_DIR /src/redrock-templates

RUN mkdir /homedir && chmod 777 /homedir
ENV HOME /homedir

ENV HDF5_USE_FILE_LOCKING FALSE
ENV GQPMC_DIR $HOME

# set prompt and default shell
SHELL ["/bin/bash", "-c"]

RUN echo "export PS1='[container] \\u@\\h:\\w$ '" >> $HOME/.bashrc \
# Create config files in $HOME
&& python -c "import astropy" \
&& python -c "import matplotlib.font_manager as fm; f = fm.FontManager()" \
&& ipython -c "print('hello')"

ENTRYPOINT ["/bin/bash", "-c"]
CMD ["/bin/bash"]
25 changes: 25 additions & 0 deletions docker/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Build a Docker container for the gqp_mc project.
================================================

```
docker build . -t desihub/gqp_mc
docker push desihub/gqp_mc:latest

docker tag desihub/gqp_mc:latest desihub/gqp_mc:v0.0.1
docker push desihub/gqp_mc:v0.0.1
```

To enter the container (with a shell prompt) on a laptop do:
```
docker pull desihub/gqp_mc:latest
docker run -it desihub/gqp_mc:latest
```

Or at NERSC:
```
shifterimg pull docker:desihub/gqp_mc:latest
shifter --image docker:desihub/gqp_mc:latest bash
```

To use this image with Jupyter check out the instructions here:
https://docs.nersc.gov/services/jupyter/#shifter-kernels-on-jupyter