diff --git a/Dockerfile b/Dockerfile index 76df4b17d8f96b9c4f2c51ad7b372c8f2a55bf64..f4cd59164e8d7cbc6e68260f81bfe27f4a041393 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,4 @@ -FROM usgs/hazdev-base-images:latest-centos - -MAINTAINER Jeremy Fee <jmfee@usgs.gov> -LABEL usgs.geomag-algorithms.version=0.4.0 - +FROM usgs/hazdev-base-images:latest-centos AS pycurl-build # install conda dependencies RUN yum install -y \ @@ -12,7 +8,6 @@ RUN yum install -y \ && \ yum clean all - # install conda ENV PATH /conda/bin:$PATH RUN echo 'export PATH=/conda/bin:$PATH' > /etc/profile.d/conda.sh && \ @@ -21,11 +16,6 @@ RUN echo 'export PATH=/conda/bin:$PATH' > /etc/profile.d/conda.sh && \ /bin/bash ~/miniconda.sh -b -p /conda && \ rm ~/miniconda.sh - -# copy library (ignores set in .dockerignore) -COPY . /geomag-algorithms - - # install algorithms and dependencies via conda RUN conda config --set ssl_verify $SSL_CERT_FILE && \ conda config --add channels obspy && \ @@ -34,9 +24,22 @@ RUN conda config --set ssl_verify $SSL_CERT_FILE && \ # build pycurl with SFTP support export PIP_CERT=$SSL_CERT_FILE && \ export PYCURL_SSL_LIBRARY=nss && \ - pip install pycurl && \ - # end build pycurl - pip install /geomag-algorithms && \ + pip install pycurl + + +FROM usgs/hazdev-base-images:latest-centos +MAINTAINER Jeremy Fee <jmfee@usgs.gov> +LABEL usgs.geomag-algorithms.version=0.4.0 + +# 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 + +RUN pip install /geomag-algorithms && \ useradd \ -c 'Docker image user' \ -m \ @@ -46,7 +49,6 @@ RUN conda config --set ssl_verify $SSL_CERT_FILE && \ mkdir -p /home/geomag_user/notebooks && \ chown -R geomag_user:geomag_user /home/geomag_user - USER geomag_user WORKDIR /home/geomag_user