diff --git a/Dockerfile b/Dockerfile index 97cf52e502e44afc76bf3f4de782a053f58ed0b3..f4cd59164e8d7cbc6e68260f81bfe27f4a041393 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,12 @@ -FROM debian:jessie +FROM usgs/hazdev-base-images:latest-centos AS pycurl-build -MAINTAINER Jeremy Fee <jmfee@usgs.gov> -LABEL usgs.geomag-algorithms.version=0.2.0 - -# update os -RUN apt-get update --fix-missing && \ - apt-get install -y --no-install-recommends \ +# install conda dependencies +RUN yum install -y \ bzip2 \ - ca-certificates \ - curl \ gcc \ - libcurl4-gnutls-dev \ - libglib2.0-0 \ - libgnutls28-dev \ - libsm6 \ - libxext6 \ - libxrender1 && \ - apt-get clean - + libcurl-devel \ + && \ + yum clean all # install conda ENV PATH /conda/bin:$PATH @@ -27,25 +16,30 @@ RUN echo 'export PATH=/conda/bin:$PATH' > /etc/profile.d/conda.sh && \ /bin/bash ~/miniconda.sh -b -p /conda && \ rm ~/miniconda.sh +# install algorithms and dependencies via conda +RUN conda config --set ssl_verify $SSL_CERT_FILE && \ + conda config --add channels obspy && \ + conda install --yes jupyter obspy && \ + conda clean -i -l -t -y && \ + # build pycurl with SFTP support + export PIP_CERT=$SSL_CERT_FILE && \ + export PYCURL_SSL_LIBRARY=nss && \ + pip install pycurl -# copy library (ignores set in .dockerignore) -COPY . /geomag-algorithms +FROM usgs/hazdev-base-images:latest-centos +MAINTAINER Jeremy Fee <jmfee@usgs.gov> +LABEL usgs.geomag-algorithms.version=0.4.0 -# configure DOI SSL intercept certificate -# (required when building image from within DOI network) -RUN mkdir -p /usr/local/share/ca-certificates && \ - cp /geomag-algorithms/etc/DOIRootCA2.crt /usr/local/share/ca-certificates/. && \ - update-ca-certificates && \ - conda config --set ssl_verify /etc/ssl/certs/ca-certificates.crt +# use conda install from build container +ENV PATH /conda/bin:$PATH +COPY --from=pycurl-build /conda /conda +COPY --from=pycurl-build /etc/profile.d/conda.sh /etc/profile.d/conda.sh +# copy library (ignores set in .dockerignore) +COPY . /geomag-algorithms -# install algorithms and dependencies via conda -RUN conda config --add channels obspy && \ - conda install --yes jupyter obspy && \ - conda clean -i -l -t -y && \ - pip install pycurl && \ - pip install /geomag-algorithms && \ +RUN pip install /geomag-algorithms && \ useradd \ -c 'Docker image user' \ -m \ @@ -55,7 +49,6 @@ RUN conda config --add channels obspy && \ mkdir -p /home/geomag_user/notebooks && \ chown -R geomag_user:geomag_user /home/geomag_user - USER geomag_user WORKDIR /home/geomag_user diff --git a/README.md b/README.md index 94c07e4f0976751c8d422697e314bfacc325728a..98cbeae3e6487787e90d4351cc316bac49bfbaad 100644 --- a/README.md +++ b/README.md @@ -88,10 +88,24 @@ Docker is the simplest install option. from the image `usgs/geomag-algorithms` on docker hub ``` - docker run -d --name geomagio -p 8000:80 usgs/geomag-algorithms + docker run -d --name geomagio -p 8000:8000 usgs/geomag-algorithms ``` -2. Use the running container +2. Find the token, (the token improves security) + + ``` + docker logs geomagio + ``` + + This outputs a URL to copy/paste into your browser address bar: + ``` + Copy/paste this URL into your browser when you connect for the first time, + to login with a token: + http://localhost:8000/?token=TOKEN + ``` + + +3. Use the running container - Run the `geomag.py` command line interface: @@ -99,10 +113,10 @@ Docker is the simplest install option. docker exec -it geomagio geomag.py ``` - - Run python interactively in a web browser: + - Run python interactively in a web browser (using the token found in step 2): ``` - open http://localhost:8000 + http://localhost:8000/?token=TOKEN ``` > In the top right corner, choose "New" then "Python 2" diff --git a/setup.py b/setup.py index d74bc0f5f276d4e3d0e4fc45049efde86ef8d630..a48b62df0bd1ce5de44e63e87e0215e517295414 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from distutils.core import setup setup( name='geomag-algorithms', - version='0.3.1', + version='0.4.0', description='USGS Geomag IO Library', url='https://github.com/usgs/geomag-algorithms', packages=[