Skip to content
Snippets Groups Projects
Commit 0fedc98b authored by Jeremy M Fee's avatar Jeremy M Fee
Browse files

Use multi-stage build to remove gcc compiler from image

parent c26fe480
No related branches found
No related tags found
No related merge requests found
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment